Java String Accent removeAccent(String s)

Here you can find the source of removeAccent(String s)

Description

Removes accent from given string.

License

Open Source License

Parameter

Parameter Description
s String containing accent characters.

Return

String without accent characters.

Declaration

public static String removeAccent(String s) 

Method Source Code

//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("");
    }
}

Related

  1. equalsIgnoreAccentsAndCase(String s1, String s2)
  2. equalsIgnoreCaseAndAccent(String string1, String string2, Locale locale)
  3. equalsStringIgnoringAccents(String str1, String str2)
  4. getDeAccentLoweredChars(String word)
  5. normalizeByRemovingAccent(final String string)
  6. removeAccent(String s)
  7. removeAccent(String strIn)
  8. removeAccents(final String s)
  9. removeAccents(final String value)