public final class StringUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FOLDER_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
static int |
count(String s,
char c) |
static int |
damerauLevenshteinDistance(CharSequence source,
CharSequence target)
Calculate the Damerau-Levenshtein Distance between two strings.
|
static byte[] |
decode(String s) |
static String |
encode(byte[] bytes)
Convert a byte array into a printable format containing a
String of hex digit characters (two per byte).
|
static boolean |
equals(String str1,
String str2) |
static boolean |
equalsIgnoreCase(String s1,
String s2) |
static boolean |
equalsIgnoreCaseWithTrim(String s1,
String s2) |
static boolean |
equalsWithTrim(String s1,
String s2) |
static String |
getRandomChar(Random random,
boolean upper) |
static String |
getRandomString(Random random,
int minLen,
int maxLen) |
static boolean |
hasContent(String s) |
static boolean |
isEmpty(String s) |
static int |
lastIndexOf(String path,
char ch) |
static int |
length(String s)
Use this method when you don't want a length check to
throw a NullPointerException when
|
static int |
levenshteinDistance(CharSequence s,
CharSequence t)
The Levenshtein distance is a string metric for measuring the difference between two sequences.
|
static int |
trimLength(String s)
Returns the length of the trimmed string.
|
public static final String FOLDER_SEPARATOR
public static boolean isEmpty(String s)
public static boolean hasContent(String s)
public static int length(String s)
s
- string to return length ofpublic static int trimLength(String s)
public static int lastIndexOf(String path, char ch)
public static byte[] decode(String s)
public static String encode(byte[] bytes)
bytes
- array representationpublic static int count(String s, char c)
public static int levenshteinDistance(CharSequence s, CharSequence t)
s
- String onet
- String twopublic static int damerauLevenshteinDistance(CharSequence source, CharSequence target)
source
- Source input stringtarget
- Target input stringpublic static String getRandomString(Random random, int minLen, int maxLen)
random
- Random instanceminLen
- minimum number of charactersmaxLen
- maximum number of charactersCopyright © 2014. All rights reserved.