List of utility methods to do String Accent
String | removeAccents(String str) Remove acentos dos caracteres trocando eles por caracteres sem acentos. str = Normalizer.normalize(str, Normalizer.Form.NFD); str = str.replaceAll("[\\p{InCombiningDiacriticalMarks}]", ""); return str; |
String | removeAccents(String text) remove Accents return Normalizer.normalize(text, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); |
String | removeAccents(String textWithAccent) remove Accents String normalizeFileName = Normalizer.normalize(textWithAccent, Normalizer.Form.NFD); return normalizeFileName.replaceAll("[^\\p{ASCII}]", ""); |
String | removeAccentsAndNonStandardCharacters(String string) remove Accents And Non Standard Characters String normalizedText = string; if (NORMALIZE_METHOD != null) { try { normalizedText = (String) NORMALIZE_METHOD.invoke(null, string, NFD_VALUE); } catch (Exception ex) { normalizedText = string; return CLEANUP_PATTERN.matcher(normalizedText).replaceAll("").toLowerCase(); |
String | removeAccentuation(String str) remove Accentuation if (str == null || str.isEmpty() || str.matches("[\\w\\s\\.\\,\\;\\:\\!\\?\\+]*")) return str; return Normalizer.normalize(str, Normalizer.Form.NFD).replaceAll("[\u0300-\u036f]", ""); |
String | replaceAccent(String strInit) This function converts French diacritics characters into non diacritics. char charTest; char[] tabTemp = strInit.toCharArray(); char[] voyelle = { 'a', 'c', 'e', 'i', 'o', 'u', 'y' }; Collator collator = Collator.getInstance(java.util.Locale.FRENCH); collator.setStrength(Collator.PRIMARY); for (int i = 0; i < strInit.length(); i++) { charTest = strInit.charAt(i); if ((charTest > 191) && (charTest < 256)) { ... |
int | replaceAccentedChars(StringBuilder buffer) replace Accented Chars int sizeBefore = buffer.length(); String s = Normalizer.normalize(buffer, Normalizer.Form.NFD); int sizeAfter = s.length(); int replaced = sizeAfter - sizeBefore; if (replaced <= 0) { return 0; s = s.replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); ... |
String | replaceAccents(String string) replace Accents String withoutAccent = Normalizer.normalize(string, Form.NFD).replaceAll(ASCII_REPLACEMENT, EMPTY_STRING); if (withoutAccent.isEmpty() && !string.isEmpty()) withoutAccent = string; return withoutAccent; |
String | stripAccents(final String input) Removes diacritics (~= accents) from a string. if (input == null) { return null; final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); final StringBuilder decomposed = new StringBuilder(Normalizer.normalize(input, Normalizer.Form.NFD)); convertRemainingAccentCharacters(decomposed); return pattern.matcher(decomposed).replaceAll(EMPTY); |
String | stripAccents(final String input) Removes diacritics (~= accents) from a string. if (input == null) { return null; final Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); final String decomposed = Normalizer.normalize(input, Normalizer.Form.NFD); return pattern.matcher(decomposed).replaceAll(""); |