Java Utililty Methods String Normalize

List of utility methods to do String Normalize

Description

The list of methods to do String Normalize are organized into topic(s).

Method

Stringnormalize(String name)
normalize
return normalize(name, -1);
Stringnormalize(String s)
Replaces all the funky characters with normal ASCII
return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
Stringnormalize(String s)
java.text.Normalizer is only available for jdk 1.6.
return s;
Stringnormalize(String s)
Normalizes a string by removing features that should not be considered as differentiating between two strings (such as accents and case).
s = Normalizer.normalize(s, Normalizer.Form.NFD);
s = s.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
s = s.toLowerCase();
s = s.replaceAll("[^a-z0-9]+", " ");
s = s.replaceAll("([a-z])([0-9])", "$1 $2");
s = s.replaceAll("([0-9])([a-z])", "$1 $2");
return s;
Stringnormalize(String s)
normalize
String d = Normalizer.normalize(s, Normalizer.Form.NFKD);
d = diacriticalMarksPattern.matcher(d).replaceAll("");
return Normalizer.normalize(d, Normalizer.Form.NFKC);
Stringnormalize(String string)
normalize
StringBuilder sb = new StringBuilder(string.length());
string = Normalizer.normalize(string, Normalizer.Form.NFD);
for (char c : string.toCharArray()) {
    if (c <= '\u007F')
        sb.append(c);
return sb.toString();
Stringnormalize(String string)
normalize
if (string != null) {
    string = Normalizer.normalize(string, NORMALIZATION_FORM);
return string;
Stringnormalize(String string)
normalize
if (string != null) {
    Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
    String decomposed = Normalizer.normalize(string, Normalizer.Form.NFD);
    return pattern.matcher(decomposed).replaceAll("");
} else {
    return null;
Stringnormalize(String text)
normalize
return text == null ? null
        : Normalizer.normalize(text, Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
Stringnormalize(String text)
normalize
String[] texts = normalize(new String[] { text });
return texts[0];