Here you can find the source of deAccent(String str)
Parameter | Description |
---|---|
str | a parameter |
public static String deAccent(String str)
//package com.java2s; /******************************************************************************* * Copyright (c) 2016 Weasis Team and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*w w w.jav a 2 s .c o m*/ * Nicolas Roduit - initial API and implementation *******************************************************************************/ import java.text.Normalizer; import java.util.regex.Pattern; public class Main { /** * Removing diacritical marks aka accents * * @param str * @return the input string without accents */ public static String deAccent(String str) { String nfdNormalizedString = Normalizer.normalize(str, Normalizer.Form.NFD); Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+"); //$NON-NLS-1$ return pattern.matcher(nfdNormalizedString).replaceAll(""); //$NON-NLS-1$ } }