Java String Accent stripAccents(final String s)

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

Description

Remove accents

License

Apache License

Parameter

Parameter Description
s a parameter

Declaration

private static String stripAccents(final String s) 

Method Source Code


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

import java.text.Normalizer;

public class Main {
    /**/* w  w w . j a  v a2  s .  c  o m*/
     * <p>
     * Remove accents
     * </p>
     * 
     * @param s
     * @return
     */
    private static String stripAccents(final String s) {
        return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
    }

    /**
     * <p>
     * normalize a string
     * </p>
     * 
     * @param s
     * @return
     */
    public static String normalize(final String s) {
        return stripAccents(String.valueOf(s.toLowerCase()));
    }
}

Related

  1. replaceAccent(String strInit)
  2. replaceAccentedChars(StringBuilder buffer)
  3. replaceAccents(String string)
  4. stripAccents(final String input)
  5. stripAccents(final String input)
  6. stripAccents(String input)
  7. stripAccents(String input)
  8. stripAccents(String input)
  9. stripAccents(String v)