|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.owasp.esapi.StringUtilities
public class StringUtilities
String utilities used in various filters.
Constructor Summary | |
---|---|
StringUtilities()
|
Method Summary | |
---|---|
static boolean |
contains(StringBuilder input,
char c)
Returns true if the character is contained in the provided StringBuilder. |
static int |
getLevenshteinDistance(String s,
String t)
Calculate the Edit Distance between 2 Strings as a measure of similarity. |
static boolean |
isEmpty(String str)
Returns true if String is empty ("") or null. |
static boolean |
notNullOrEmpty(String str,
boolean trim)
Check to ensure that a String is not null or empty (after optional
trimming of leading and trailing whitespace). |
static String |
replaceLinearWhiteSpace(String input)
|
static String |
replaceNull(String test,
String replace)
Returns the replace value if the value of test is null, "null", or "" |
static String |
stripControls(String input)
Removes all unprintable characters from a string and replaces with a space. |
static char[] |
union(char[]... list)
Union multiple character arrays. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringUtilities()
Method Detail |
---|
public static String replaceLinearWhiteSpace(String input)
public static String stripControls(String input)
input
-
public static char[] union(char[]... list)
list
- the char[]s to union
public static boolean contains(StringBuilder input, char c)
input
- The inputc
- The character to check for to see if input
contains.
public static String replaceNull(String test, String replace)
test
- The value to testreplace
- The replacement value
public static int getLevenshteinDistance(String s, String t)
s
- The source stringt
- The target String
public static boolean notNullOrEmpty(String str, boolean trim)
String
is not null or empty (after optional
trimming of leading and trailing whitespace). Usually used with
assertions, as in
assert StringUtils.notNullOrEmpty(cipherXform, true) : "Cipher transformation may not be null or empty!";
str
- The String
to be checked.trim
- If true
, the string is first trimmed before checking
to see if it is empty, otherwise it is not.
public static boolean isEmpty(String str)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |