@Test public void removeDiacritics() { String value = "\u0301aáLEßæ Łók"; assertEquals("aaLEssae Lok", DiacriticsRemover.removeDiacritics(value)); }
public static String removeDiacritics(String text) { if (text == null) { return null; } String tmp = Normalizer.normalize(text, Normalizer.Form.NFKD); StringBuilder builder = new StringBuilder(); for (int i = 0; i < tmp.length(); i++) { Character ch = tmp.charAt(i); if (Character.getType(ch) == Character.NON_SPACING_MARK) { continue; } if (lookup.containsKey(ch)) { builder.append(lookup.get(ch)); } else { builder.append(ch); } } return builder.toString(); }
DiacriticsRemover { public static String removeDiacritics(String text) { if (text == null) { return null; } String tmp = Normalizer.normalize(text, Normalizer.Form.NFKD); StringBuilder builder = new StringBuilder(); for (int i = 0; i < tmp.length(); i++) { Character ch = tmp.charAt(i); if (Character.getType(ch) == Character.NON_SPACING_MARK) { continue; } if (lookup.containsKey(ch)) { builder.append(lookup.get(ch)); } else { builder.append(ch); } } return builder.toString(); } }
DiacriticsRemover { public static String removeDiacritics(String text) { if (text == null) { return null; } String tmp = Normalizer.normalize(text, Normalizer.Form.NFKD); StringBuilder builder = new StringBuilder(); for (int i = 0; i < tmp.length(); i++) { Character ch = tmp.charAt(i); if (Character.getType(ch) == Character.NON_SPACING_MARK) { continue; } if (lookup.containsKey(ch)) { builder.append(lookup.get(ch)); } else { builder.append(ch); } } return builder.toString(); } private  DiacriticsRemover(); }
DiacriticsRemover { public static String removeDiacritics(String text) { if (text == null) { return null; } String tmp = Normalizer.normalize(text, Normalizer.Form.NFKD); StringBuilder builder = new StringBuilder(); for (int i = 0; i < tmp.length(); i++) { Character ch = tmp.charAt(i); if (Character.getType(ch) == Character.NON_SPACING_MARK) { continue; } if (lookup.containsKey(ch)) { builder.append(lookup.get(ch)); } else { builder.append(ch); } } return builder.toString(); } private  DiacriticsRemover(); static String removeDiacritics(String text); }
DiacriticsRemover { public static String removeDiacritics(String text) { if (text == null) { return null; } String tmp = Normalizer.normalize(text, Normalizer.Form.NFKD); StringBuilder builder = new StringBuilder(); for (int i = 0; i < tmp.length(); i++) { Character ch = tmp.charAt(i); if (Character.getType(ch) == Character.NON_SPACING_MARK) { continue; } if (lookup.containsKey(ch)) { builder.append(lookup.get(ch)); } else { builder.append(ch); } } return builder.toString(); } private  DiacriticsRemover(); static String removeDiacritics(String text);  }