Here you can find the source of removeAccents(final String value)
Parameter | Description |
---|---|
value | input value |
public static String removeAccents(final String value)
//package com.java2s; import java.text.Normalizer; import java.util.regex.Pattern; public class Main { /** Empty String constant '' */ public final static String STRING_EMPTY = ""; /** regular expression used to match characters with accents */ private final static Pattern PATTERN_ACCENT_CHARS = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); /**/* w ww. j av a2 s. com*/ * Remove accents from any character i.e. remove diacritical marks * @param value input value * @return string value */ public static String removeAccents(final String value) { // Remove accent from characters (if any) (Java 1.6) final String normalized = Normalizer.normalize(value, Normalizer.Form.NFD); return PATTERN_ACCENT_CHARS.matcher(normalized).replaceAll(STRING_EMPTY); } }