Here you can find the source of removeAccent(String s)
Parameter | Description |
---|---|
s | String containing accent characters. |
public static String removeAccent(String s)
//package com.java2s; //License from project: Open Source License import java.text.Normalizer; import java.util.regex.Pattern; public class Main { private static final String REMOVE_ACCENT_PATTERN = "\\p{InCombiningDiacriticalMarks}+"; /**//w w w . j av a 2 s . co m * Removes accent from given string. * * @param s * String containing accent characters. * @return String without accent characters. */ public static String removeAccent(String s) { String temp = Normalizer.normalize(s, Normalizer.Form.NFD); Pattern pattern = Pattern.compile(REMOVE_ACCENT_PATTERN); return pattern.matcher(temp).replaceAll(""); } }