public class StringUtils extends Object
|Constructor and Description|
|Modifier and Type||Method and Description|
Finds the Optimal string alignment distance – also referred to as the Damerau-Levenshtein distance – between two strings.
This is the number of changes needed to change one string into another (insertions, deletions or substitutions of a single character, or transpositions of two adjacent characters).
This implementation is based on the Apache Commons Lang implementation of the Levenshtein distance, only adding support for transpositions.
Note that this is the distance used in Lucene for
FuzzyTermsEnum. Lucene itself has
an implementation of this algorithm, but it is much less efficient in terms of space (also note
that Lucene's implementation does not return the distance, but a similarity score based on it).
s- the first string, must not be
t- the second string, must not be
IllegalArgumentException- if either String input is
Copyright © 2012–2018. All rights reserved.