@Deprecated public final class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
getLevenshteinDistance(String s,
String t)
Deprecated.
Find the Levenshtein distance between two Strings.
|
static String |
joinQuotedString(String[] str,
String delimiter,
int initialIndex,
String quote)
Deprecated.
Join an array of strings into a string.
|
static String |
joinString(Collection<?> str,
String delimiter,
int initialIndex)
Deprecated.
Join an list of strings into a string.
|
static String |
joinString(int[] str,
String delimiter,
int initialIndex)
Deprecated.
Join an array of strings into a string.
|
static String |
joinString(Object[] str,
String delimiter,
int initialIndex)
Deprecated.
Join an array of strings into a string.
|
static String |
joinString(String[] str,
String delimiter)
Deprecated.
Join an array of strings into a string.
|
static String |
joinString(String[] str,
String delimiter,
int initialIndex)
Deprecated.
Join an array of strings into a string.
|
static <T extends Enum<?>> |
lookup(Map<String,T> lookup,
String name,
boolean fuzzy)
Deprecated.
|
static String |
trimLength(String str,
int len)
Deprecated.
Trim a string if it is longer than a certain length.
|
public static String trimLength(String str, int len)
str - the stirnglen - the length to trim topublic static String joinString(String[] str, String delimiter, int initialIndex)
str - the string arraydelimiter - the delimiterinitialIndex - the initial index to start formpublic static String joinQuotedString(String[] str, String delimiter, int initialIndex, String quote)
str - the string arraydelimiter - the delimiterinitialIndex - the initial index to start formquote - the character to put around each entrypublic static String joinString(String[] str, String delimiter)
str - the string arraydelimiter - the delimiterpublic static String joinString(Object[] str, String delimiter, int initialIndex)
str - an array of objectsdelimiter - the delimiterinitialIndex - the initial index to start formpublic static String joinString(int[] str, String delimiter, int initialIndex)
str - a list of integersdelimiter - the delimiterinitialIndex - the initial index to start formpublic static String joinString(Collection<?> str, String delimiter, int initialIndex)
str - a list of stringsdelimiter - the delimiterinitialIndex - the initial index to start formpublic static int getLevenshteinDistance(String s, String t)
Find the Levenshtein distance between two Strings.
This is the number of changes needed to change one String into another, where each change is a single character modification (deletion, insertion or substitution).
The previous implementation of the Levenshtein distance algorithm was from http://www.merriampark.com/ld.htm
Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError
which can occur when my Java implementation is used with very large strings.
This implementation of the Levenshtein distance algorithm
is from http://www.merriampark.com/ldjava.htm
StringUtil.getLevenshteinDistance(null, *) = IllegalArgumentException
StringUtil.getLevenshteinDistance(*, null) = IllegalArgumentException
StringUtil.getLevenshteinDistance("","") = 0
StringUtil.getLevenshteinDistance("","a") = 1
StringUtil.getLevenshteinDistance("aaapppp", "") = 7
StringUtil.getLevenshteinDistance("frog", "fog") = 1
StringUtil.getLevenshteinDistance("fly", "ant") = 3
StringUtil.getLevenshteinDistance("elephant", "hippo") = 7
StringUtil.getLevenshteinDistance("hippo", "elephant") = 7
StringUtil.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
StringUtil.getLevenshteinDistance("hello", "hallo") = 1
s - the first String, must not be nullt - the second String, must not be nullIllegalArgumentException - if either String input nullCopyright © 2015. All Rights Reserved.