Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. ó --> o
  2. í --> i
  3.  
  4. myString = myString.replaceAll("ó","o");
  5.  
  6. String normalized = Normalizer.normalize(input, Normalizer.Form.NFD);
  7. String accentRemoved = normalized.replaceAll("\p{InCombiningDiacriticalMarks}+", "");
  8.  
  9. public class Main {
  10. public static void main(String[] args) {
  11. String input = "Árvíztűrő tükörfúrógép";
  12. System.out.println("Input: " + input);
  13. String normalized = Normalizer.normalize(input, Normalizer.Form.NFD);
  14. System.out.println("Normalized: " + normalized);
  15. String accentRemoved = normalized.replaceAll("\p{InCombiningDiacriticalMarks}+", "");
  16. System.out.println("Result: " + accentRemoved);
  17. }
  18. }
  19.  
  20. Input: Árvíztűrő tükörfúrógép
  21. Result: Arvizturo tukorfurogep
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement