fork(3) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.text.Normalizer;
  8. import java.text.Normalizer.Form;
  9. import java.util.regex.*;
  10.  
  11. /* Name of the class has to be "Main" only if the class is public. */
  12. class Ideone
  13. {
  14. public static void main (String[] args) throws java.lang.Exception
  15. {
  16. String original = "Carmen López-Delina Santos";
  17. String res = removeAccents(original).replaceAll("[^A-Za-z ]", "");
  18. System.out.println(res);
  19. }
  20.  
  21. public static String removeAccents(String text) {
  22. return text == null ? null :
  23. Normalizer.normalize(text, Form.NFD)
  24. .replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
  25. }
  26. }
Success #stdin #stdout 0.13s 320832KB
stdin
Standard input is empty
stdout
Carmen LopezDelina Santos