|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jac.util.Strings
Various often used string functions
Constructor Summary | |
Strings()
|
Method Summary | |
static String |
createPathString(Collection paths)
Create a path string, using the appropriate path separator |
static void |
deleteChars(String delChars,
StringBuffer s)
Delete occurences of characters from a StringBuffer |
static boolean |
equalsUSAsciiNoCase(String a,
String b)
Compares the USAscii representation of two strings in a case insensitive manner. |
static String |
fromISO8859_1(String s)
Convert a String to a string with onlu iso-8859-1 characters. |
static String |
getShortClassName(Class cl)
|
static String |
getShortClassName(String className)
|
static String |
hash(Object o)
|
static String |
hex(Object o)
Build a String representation of an object of the form <classname>@<hashcode> |
static boolean |
isEmpty(String str)
Tells if a string is empty (is null, has a zero length, or contains only whitespaces) |
static String |
join(Collection items,
String separator)
Builds a string formed by the toString() of items from a collection separated by a separator string. |
static String |
join(String[] items,
String separator)
|
static String |
newString(char c,
int length)
Build a string with a given length and all the characters equals. |
static String |
replace(String oldChars,
char newChar,
String s)
Replaces all occurences of some characters by a character |
static void |
replace(String oldChars,
char newChar,
StringBuffer s)
Replaces all occurences of some characters by a character |
static String |
replace(String orgString,
String oldString,
String newString)
A useful method that replaces all the occurences of a string. |
static String |
safeJoin(Collection items,
String separator)
Builds a string formed by the toString() of items from a collection separated by a separator string. |
static String |
slashify(String str)
The reverse of unslashify. slashify(unslashify(str)).equals(str). |
static String[] |
split(String source,
String separator)
Split a string into an array |
static String[] |
splitPath(String paths)
Split a list of paths separated by path.separator |
static List |
splitToList(String source,
String separator)
Split a string into a list of strings |
static String |
toISO8599_1(String s)
Convert a String to a string with onlu iso-8859-1 characters. |
static void |
toLowerCase(StringBuffer s)
Lowers all characters of a StringBuffer |
static String |
toString(Collection list)
Build a String representation of a vector in the way as Vector.toString(), but without brackets. |
static String |
toString(Map map)
|
static void |
toUpperCase(StringBuffer s)
Uppers all characters of a StringBuffer |
static String |
toUSAscii(String s)
|
static void |
toUSAscii(StringBuffer s)
Replace accented chars with their non-accented value. |
static String |
trimWSAndCRLF(String str)
Removes all whitespace and CR/LF characters at the beginning or at the end of a string. |
static String |
unslashify(String str)
Replace slashed characters ("\t" -> '\t',"\r" -> '\t', "\n" -> '\n' ,"\f" -> '\f' , "\_" -> ' ') |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Strings()
Method Detail |
public static String unslashify(String str)
slashify(String)
public static String slashify(String str)
unslashify(String)
public static String[] split(String source, String separator)
source
- string to splitseparator
- the separator
splitToList(String,String)
public static List splitToList(String source, String separator)
source
- string to splitseparator
- the separator
split(String,String)
public static String join(Collection items, String separator)
items
- the collection. It must not contain null valuesseparator
- the separator stringjoin(String[],String)
public static String safeJoin(Collection items, String separator)
items
- the collection. It may contain null values.separator
- the separator stringjoin(String[],String)
public static String join(String[] items, String separator)
join(Collection,String)
public static String[] splitPath(String paths)
public static String createPathString(Collection paths)
paths
- a collection of File
public static String hex(Object o)
o
- the object to stringify
public static String hash(Object o)
public static String toString(Collection list)
list
- the vector to stringify
public static String toString(Map map)
public static String newString(char c, int length)
c
- the character to fill the string withlength
- the length of the string
public static String replace(String orgString, String oldString, String newString)
orgString
- the original stringoldString
- the string to replace (if found) in the
original stringnewString
- the string that replaces all the occurences of
old string
public static void replace(String oldChars, char newChar, StringBuffer s)
oldChars
- the characters that should be replacednewChar
- the character by which to replaces
- the string buffer whose's characters must be replacedpublic static String replace(String oldChars, char newChar, String s)
oldChars
- the characters that should be replacednewChar
- the character by which to replaces
- the string whose's characters must be replacedpublic static void deleteChars(String delChars, StringBuffer s)
delChars
- the characters to deletes
- the StringBuffer to remlove the characters frompublic static String getShortClassName(Class cl)
public static String getShortClassName(String className)
public static String toUSAscii(String s)
public static void toLowerCase(StringBuffer s)
public static void toUpperCase(StringBuffer s)
public static void toUSAscii(StringBuffer s)
s
- string to convert
public static boolean equalsUSAsciiNoCase(String a, String b)
a
- first string to compareb
- second string to compare
public static boolean isEmpty(String str)
str
- string to test
public static String trimWSAndCRLF(String str)
str
- the string to trimpublic static String toISO8599_1(String s)
s
- strng to encodefromISO8859_1(String)
public static String fromISO8859_1(String s)
s
- string to decodefromISO8859_1(String)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |