Here you can find the source of normalize(String text)
Parameter | Description |
---|---|
text | a parameter |
public static String normalize(String text)
//package com.java2s; //License from project: Open Source License import java.text.Normalizer; public class Main { /**/*w w w . jav a 2 s. c om*/ * Removes diacritics from UTF-8 * @param text * @return lower case version of text with all diacritic marks removed */ public static String normalize(String text) { String result = text; try { while (result.length() > 1 && !Character.isAlphabetic(result.charAt(0))) { if (result.length() > 1) { result = result.substring(1, result.length()); } } result = Normalizer.normalize(result.toLowerCase(), Normalizer.Form.NFD); result = result.replaceAll( "[\\p{InCombiningDiacriticalMarks}]", ""); } catch (Exception e) { e.printStackTrace(); } return result; } }