Hackerss.com

Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in
hackerss
hackerss

Posted on

Java From a string conver accent letters to non accent


public class AccentConverter {

    public static void main(String[] args) {

        String str = "áéíóúÁÉÍÓÚ";

        System.out.println(str);
        System.out.println(convertAccentLetters(str));

    }

    public static String convertAccentLetters(String str) {

        str = Normalizer.normalize(str, Normalizer.Form.NFD);
        str = str.replaceAll("[^\\p{ASCII}]", "");

        return str;

    }

}
Enter fullscreen mode Exit fullscreen mode

Oldest comments (0)