com.ch.odi.common
Class Strings
java.lang.Object
|
+--com.ch.odi.common.Strings
- public class Strings
- extends Object
Description: This class contains static functions that operate on Strings.
Copyright: Copyright (c) 2002 Ortwin Glück
|
Method Summary |
static String |
cleanString(String s,
int maxlen)
Replaces single apostrophes (') with double apostrophes('')
for use in SQL queries and cuts the string to a maximum length.
|
static String |
replace(String in,
String s,
String r)
Replaces all occurences of a string with another string.
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Strings
public Strings()
cleanString
public static String cleanString(String s,
int maxlen)
- Replaces single apostrophes (') with double apostrophes('')
for use in SQL queries and cuts the string to a maximum length.
Sample: cleanString("I can't cookie", 9)
------> "I can''t cook"
- Parameters:
s - The input stringmaxlen - The maximum length
replace
public static String replace(String in,
String s,
String r)
- Replaces all occurences of a string with another string.
Sample: replace("Java will be smart", "will be", "is")
------> "Java is smart"
- Parameters:
in - The input string to scans - The pattern to search forr - The replacement for the pattern