I have the following problem. I am trying to replace german umlauts like ä, ö, ü in java. But it simply does not work. Her
If you use Apache Commons or Commons3 in your project, it would be most efficient to use a class like
public class UmlautCleaner {
private static final String[] UMLAUTE = new String[] {"Ä", "Ö", "Ü", "ä", "ö", "ü", "ß"};
private static final String[] UMLAUTE_REPLACEMENT = new String[] {"AE", "OE", "UE", "ae", "oe", "ue", "ss"};
private UmlautCleaner() {
}
public static String cleanSonderzeichen(final String s) {
return StringUtils.stripAccents(StringUtils.replaceEach(s, UMLAUTE, UMLAUTE_REPLACEMENT));
}
}