Advertisement
Guest User

remove accents in java

a guest
Aug 12th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.     public static String removeAccents(String s) {
  2.         if (s == null) {
  3.             return null;
  4.         }
  5.         StringBuilder sb = new StringBuilder(s);
  6.  
  7.         for(int i = 0; i < s.length(); i++) {
  8.             Character c = MAP_NORM.get(sb.charAt(i));
  9.             if(c != null) {
  10.                 switch (c)
  11.                 {
  12.                   case 'ยด':
  13.                   case '`':
  14.                   case '^':
  15.                   case '~':
  16.                   case 'ยจ':
  17.                   continue;
  18.                 }
  19.                 sb.setCharAt(i, c.charValue());
  20.             }
  21.         }
  22.  
  23.         return sb.toString();
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement