Java String Diacritics removeDiacritics(String input)

Here you can find the source of removeDiacritics(String input)

Description

remove Diacritics

License

Open Source License

Declaration

public static String removeDiacritics(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.Normalizer;
import java.text.Normalizer.Form;

public class Main {

    public static String removeDiacritics(String input) {
        // Normalizer.normalise() converts each accented
        // character into 1 non-accented character followed
        // by 1 or more characters representing the accent(s)
        // alone. These characters representing only
        // an accent belong to the Unicode category
        // CombiningDiacriticalMarks. The call to replaceAll
        // strips out all characters in that category.
        String normalized = Normalizer.normalize(input, Form.NFKD);
        String cleared = normalized.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
        return cleared;
    }//from w  w w. j  a  v a2 s  .  c  o m
}

Related

  1. removeDiacriticalMarks(String string)
  2. removeDiacriticals(final String s)
  3. removeDiacritics(String input)
  4. removeDiacritics(String st)
  5. removeDiacritics(String text)
  6. removeDiacritics(String word)