Java examples for Regular Expressions:Pattern
Removing accents and diacritics from given text .
//package com.java2s; import java.text.Normalizer; public class Main { /**//from w w w .ja va2 s . co m * Removing accents and diacritics from given {@code text}. * * @param text * @return given {@code text} without accents and diacritics */ public static String removeAccents(String text) { if (text == null) { return null; } text = Normalizer.normalize(text, Normalizer.Form.NFD); return text.replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); } }