Java String Normalize normalize(final String s)

Here you can find the source of normalize(final String s)

Description

normalize a string

License

Apache License

Parameter

Parameter Description
s a parameter

Declaration

public static String normalize(final String s) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.Normalizer;

public class Main {
    /**/*from  www .  j  a  va 2s  .  co m*/
     * <p>
     * normalize a string
     * </p>
     * 
     * @param s
     * @return
     */
    public static String normalize(final String s) {
        return stripAccents(String.valueOf(s.toLowerCase()));
    }

    /**
     * <p>
     * Remove accents
     * </p>
     * 
     * @param s
     * @return
     */
    private static String stripAccents(final String s) {
        return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
    }
}

Related

  1. normaliseConll(String input)
  2. normaliseUnicode(String unicodeText, char[] mappings)
  3. normalize(final String input)
  4. normalize(final String s)
  5. normalize(final String string)
  6. normalize(final String string)
  7. normalize(Object o, StringBuffer sb)
  8. normalize(String adoc)