MCPcopy Create free account
hub / github.com/comunes/kune / deAccent

Method deAccent

src/main/java/cc/kune/common/shared/utils/TextUtils.java:225–238  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 2

testDeAccentMethod · 0.95
generateShortNameMethod · 0.95

Calls 2

lengthMethod · 0.80
toStringMethod · 0.45

Tested by 1

testDeAccentMethod · 0.76