|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.groiss.util.StringUtil
public class StringUtil
Some convenient string manipulation methods.
| Method Summary | |
|---|---|
static String |
decodeURL(String url)
|
static String |
encodeURL(String url)
This calls the URLEncoder.encode with the configured charset. |
static boolean |
equalStrings(String first,
String second)
Checks if both strings are equal. |
static boolean |
escapeForSQL(CharSequence txt)
Escapes all occurencies of character '_' in the passed string builder with the escape character '\'. |
static String |
escapeJavaStyleString(String str,
boolean escapeSingleQuote)
|
static String |
format(String pattern,
Object[] arguments)
Formats the passed pattern with the passed argument (as known by java.text.MessageFormat(String, Object []) but it guarantees that single quotes remain in the pattern (class MessageFormat would remove them). |
static String |
getCharset()
|
static Collator |
getCollator()
Returns a Collator to sort Strings correctly |
static String |
htmlDecode(String s)
Decodes html entities defined in XHTML 1.0. |
static String |
htmlEncode(Object o)
Translates some special characters to their representation in HTML. |
static boolean |
isEmpty(String s)
Is the string null or the empty string |
static boolean |
isNotEmpty(String s)
|
static boolean |
isNumber(String s)
|
static boolean |
isRTL(Locale loc)
Is the writing direction in the given locale right-to-left? |
static String |
noEmpty(Object o)
Returns " " when argument is null, otherwise o.toString() |
static String |
noEmpty(String s)
Returns " " when argument is null, otherwise the string itself. |
static String |
noNull(Object s)
Returns the empty string when argument is null, otherwise s.toString() |
static String |
noNull(String s)
Returns the empty string when argument is null, otherwise the string itself. |
static String |
noTags(String text)
De-HTMLize a string. |
static String |
quoteForSQL(String arg)
Doubles the singe quote ' to ''. |
static String |
replaceChar(String str,
char oldch,
String newStr)
Replace a character by a string. |
static void |
setCharset(String charSet)
|
static List<String> |
split(String mask,
String pat)
Split a string into pieces. |
static List<String> |
split(String mask,
String pat,
boolean withPat)
Split a string into pieces. |
static String |
substitute(String mask,
String pat,
String value)
Substitute a value for a pattern |
static String |
transformForSQL(String arg)
Replaces '*' with '%' and '?' |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String substitute(String mask,
String pat,
String value)
mask - the mask containing the patternspat - the pattern to substitutevalue - the value inserted instead of the pattern
public static String noNull(String s)
s - a string
public static String noNull(Object s)
s - a object
public static String noEmpty(String s)
s - a string
public static String noEmpty(Object o)
o - a object
public static String quoteForSQL(String arg)
arg - a string
public static String transformForSQL(String arg)
quoteForSQL(String) is called
arg - the string in which the replacements and quotes should be performed
public static boolean escapeForSQL(CharSequence txt)
txt - holds the string which should be escaped
public static String htmlEncode(Object o)
o - an object with a toString method, the string is translated
public static String htmlDecode(String s)
s - a string containing entities like <
public static String replaceChar(String str,
char oldch,
String newStr)
str - the stringoldch - the character to replacenewStr - the new string
public static List<String> split(String mask,
String pat)
mask - the mask to splitpat - the separator for splitting
public static List<String> split(String mask,
String pat,
boolean withPat)
mask - the string to splitpat - the separator for splittingwithPat - if true, the strings start with the split pattern
public static String noTags(String text)
text - a string containing HTML tags
public static boolean equalStrings(String first,
String second)
public static boolean isEmpty(String s)
s - the string
public static boolean isNotEmpty(String s)
public static String encodeURL(String url)
url - the url containing special characters
public static String decodeURL(String url)
public static String getCharset()
public static void setCharset(String charSet)
public static boolean isRTL(Locale loc)
loc - the locale
public static String format(String pattern,
Object[] arguments)
pattern - the pattern to formatarguments - the arguments for the pattern
public static boolean isNumber(String s)
public static String escapeJavaStyleString(String str,
boolean escapeSingleQuote)
public static Collator getCollator()
Returns a Collator to sort Strings correctly
ThreadLocale
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||