public class StringUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
StringUtils.Collator |
static class |
StringUtils.CollatorFFandIE |
static class |
StringUtils.CollatorSafari |
static interface |
StringUtils.StringFilter
A String Filter that can be applied on join operations
|
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY |
static String |
SPACE |
| Constructor and Description |
|---|
StringUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
charCodeAt(String str,
int i) |
static boolean |
containsValue(String multiValuedProperty,
String value) |
static boolean |
equals(String a,
String b)
This method generates a faster string comparison than
String.equals()
for web mode code. |
static int |
getLevenshteinDistance(String s,
String t)
Find the Levenshtein distance between two Strings.
|
static boolean |
isEmpty(String value) |
static boolean |
isNumeric(String str)
Check if the given string represents a number
|
static boolean |
isWhitespace(char c) |
static String |
join(String[] parts,
String join)
Join all string parts into one string, using the join parameter between each string part
|
static String |
join(String[] parts,
String join,
StringUtils.StringFilter filter) |
static int |
localeCompare(String source,
String target) |
static int |
localeCompare(String source,
String target,
boolean caseSensitive) |
static String |
lpad(String src,
int length,
char padding) |
static String |
removeAccents(String value) |
static String |
replace(String text,
String searchString,
String replacement) |
static String |
replace(String text,
String searchString,
String replacement,
int max) |
static String |
rpad(String src,
int length,
char padding) |
static String |
rTrim(String value) |
static double |
safeParseDouble(String value) |
static String |
toHEXString(String input)
Convert a raw UTF-8 string to a hex string.
|
static String |
toUpperCaseFirstChar(String text)
Transforms "some text" into "Some text"
|
static String |
toUTF8(String utf16String)
Encode an UTF-16 string (Unicode) to UTF-8.
|
static boolean |
unsafeEquals(String a,
String b)
This method generate a faster string comparison than
String.equals()
for web mode code. |
public static final String EMPTY
public static final String SPACE
public static String lpad(String src, int length, char padding)
src - length - padding - public static String rpad(String src, int length, char padding)
src - length - padding - public static boolean isEmpty(String value)
value - public static String replace(String text, String searchString, String replacement)
text - searchString - replacement - public static String replace(String text, String searchString, String replacement, int max)
text - searchString - replacement - max - public static String toUpperCaseFirstChar(String text)
text - public static boolean equals(String a, String b)
String.equals()
for web mode code.
The GWT generated String.equals() method makes a check in its parameter's type in runtime.
That method makes that assertion on compilation time (once its parameters are both
Strings).a - b - public static boolean unsafeEquals(String a, String b)
String.equals()
for web mode code. It is similar to StringUtils.equals() method.
The only difference is that this one does not check for null parameters.a - b - public static double safeParseDouble(String value)
value - public static boolean containsValue(String multiValuedProperty, String value)
multiValuedProperty - value - public static boolean isWhitespace(char c)
public static int getLevenshteinDistance(String s, String t)
Find the Levenshtein distance between two Strings.
StringUtils.getLevenshteinDistance(null, *) = IllegalArgumentException
StringUtils.getLevenshteinDistance(*, null) = IllegalArgumentException
StringUtils.getLevenshteinDistance("","") = 0
StringUtils.getLevenshteinDistance("","a") = 1
StringUtils.getLevenshteinDistance("aaapppp", "") = 7
StringUtils.getLevenshteinDistance("frog", "fog") = 1
StringUtils.getLevenshteinDistance("fly", "ant") = 3
StringUtils.getLevenshteinDistance("elephant", "hippo") = 7
StringUtils.getLevenshteinDistance("hippo", "elephant") = 7
StringUtils.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
StringUtils.getLevenshteinDistance("hello", "hallo") = 1
s - the first String, must not be nullt - the second String, must not be nullIllegalArgumentException - if either String input nullpublic static boolean isNumeric(String str)
str - public static int charCodeAt(String str, int i)
public static String toUTF8(String utf16String)
utf16String - public static String toHEXString(String input)
input - public static String join(String[] parts, String join)
parts - join - public static String join(String[] parts, String join, StringUtils.StringFilter filter)
parts - join - filter - Copyright © 2015. All rights reserved.