Create a map that maps the accented character to the unaccented one. Then iterate over map. Use the key of the map as the character you want to replace, and the value of the map as the replacement character.
Map<String, String> replacements = new LinkedHashMap<String,String>() {{
put("č", "c");
put("ž", "z");
...
put("ý", "y");
}};
then:
for(Map.Entry<String, String> entry : replacements.entrySet()) {
inputStr.replaceAll(entry.getKey(), entry.getValue());
}
This way you cut out the multiple replaceAll
calls and have a single one.
Based on Erick's reponse I found this page that talks about the different uses of Normalizer.