Removes accents from a string and replace it with ASCII equivalent (á => a). @param s The string to englishify @return The string without the accents.
(final String s)
| 223 | * @return The string without the accents. |
| 224 | */ |
| 225 | public static String deAccent(final String s) { |
| 226 | final StringBuilder b = new StringBuilder(); |
| 227 | final int n = s.length(); |
| 228 | for (int i = 0; i < n; i++) { |
| 229 | final char c = s.charAt(i); |
| 230 | final int pos = UNICODE.indexOf(c); |
| 231 | if (pos > -1) { |
| 232 | b.append(PLAIN_ASCII.charAt(pos)); |
| 233 | } else { |
| 234 | b.append(c); |
| 235 | } |
| 236 | } |
| 237 | return b.toString(); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Default string. |