fork(52) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.text.Normalizer;
  5. import java.util.regex.Pattern;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println(deAccent("Olá, mundo!"));
  13. }
  14.  
  15. public static String deAccent(String str) {
  16. String nfdNormalizedString = Normalizer.normalize(str, Normalizer.Form.NFD);
  17. Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
  18. return pattern.matcher(nfdNormalizedString).replaceAll("");
  19. }
  20. }
Success #stdin #stdout 0.13s 29940KB
stdin
Standard input is empty
stdout
Ola, mundo e i o!