Java String Accent removeAccent(String s)

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

Description

Bo dau 1 chuoi

License

Open Source License

Parameter

Parameter Description
s a parameter

Declaration

public static String removeAccent(String s) 

Method Source Code


//package com.java2s;
/*/*from   ww w  .j  a  v a  2s.com*/
 * Copyright(C) 2016 thuebannhadat.com.vn. All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * thuebannhadat.com.vn. You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license
 * agreement you entered into with thuebannhadat.com.vn.
 */

import java.text.Normalizer;
import java.util.regex.Pattern;

public class Main {
    /**
     * Bo dau 1 chuoi
     * 
     * @param s
     * @return
     */
    public static String removeAccent(String s) {
        String temp = Normalizer.normalize(s, Normalizer.Form.NFD);
        Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
        return pattern.matcher(temp).replaceAll("");
    }
}

Related

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