|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.znerd.util.text.TextUtils
public class TextUtils
Text string utility functions.
| Method Summary | |
|---|---|
static boolean |
fuzzyEquals(String s1,
String s2)
Compares the specified strings for equality, after normalizing whitespace and ignoring case. |
static boolean |
isEmpty(String s)
Checks if the specified string is either null or empty or contains only whitespace. |
static boolean |
matches(String s,
String regex)
Checks if the specified string matches the specified regular expression. |
static String |
normalizeWhitespace(String s)
Removes all leading and trailing whitespace from a string, and replaces all internal whitespace with a single space character. |
static String |
quote(Object o)
Puts quote characters around the string representation of an object, escaping all backslash and quote characters inside the string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final String quote(Object o)
"(null)" if the object is
null or if the object's toString() method returns null.
public static final boolean isEmpty(String s)
null or empty or contains only whitespace.
public static final boolean matches(String s,
String regex)
This method differs from String.matches(String) in that this method also supports partial matches. To give an example:
"bla bla".match("bla$"); // returns false
TextUtils.matches("bla bla", "bla$"); // returns true
public static boolean fuzzyEquals(String s1,
String s2)
s1 - the first string, or null.s2 - the second string, or null.
s1 and s2 are considered equal, normalizing whitespace and ignoring case.public static String normalizeWhitespace(String s)
null is passed, then "" is returned.
s - the string, or null.
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||