Class SoundexUtils
java.lang.Object
org.apache.commons.codec.language.SoundexUtils
- Since:
- 1.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static String
Cleans up the input string before Soundex processing by only returning upper case letters.(package private) static int
difference
(StringEncoder encoder, String s1, String s2) Encodes the Strings and returns the number of characters in the two encoded Strings that are the same.(package private) static int
differenceEncoded
(String es1, String es2) Returns the number of characters in the two Soundex encoded Strings that are the same.(package private) static boolean
isEmpty
(CharSequence cs) Checks if a CharSequence is empty ("") or null.
-
Constructor Details
-
SoundexUtils
SoundexUtils()
-
-
Method Details
-
clean
Cleans up the input string before Soundex processing by only returning upper case letters.- Parameters:
str
- The String to clean.- Returns:
- A clean String.
-
difference
Encodes the Strings and returns the number of characters in the two encoded Strings that are the same.- For Soundex, this return value ranges from 0 through 4: 0 indicates little or no similarity, and 4 indicates strong similarity or identical values.
- For refined Soundex, the return value can be greater than 4.
- Parameters:
encoder
- The encoder to use to encode the Strings.s1
- A String that will be encoded and compared.s2
- A String that will be encoded and compared.- Returns:
- The number of characters in the two Soundex encoded Strings that are the same.
- Throws:
EncoderException
- if an error occurs encoding one of the strings- See Also:
-
differenceEncoded
Returns the number of characters in the two Soundex encoded Strings that are the same.- For Soundex, this return value ranges from 0 through 4: 0 indicates little or no similarity, and 4 indicates strong similarity or identical values.
- For refined Soundex, the return value can be greater than 4.
- Parameters:
es1
- An encoded String.es2
- An encoded String.- Returns:
- The number of characters in the two Soundex encoded Strings that are the same.
- See Also:
-
isEmpty
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false
- Parameters:
cs
- the CharSequence to check, may be null- Returns:
true
if the CharSequence is empty or null
-