@Test public void testDecomposeToAscii() throws Exception { assertEquals(MetaMap.decomposeToAscii("xyâåäöốởxy"), "xyaaaoooxy"); assertEquals(MetaMap.decomposeToAscii("a µ b"), "a b"); assertEquals(MetaMap.decomposeToAscii("1234567890abcdefghijklmnopqrstuvwxyz\"!@#$%^&*()?"), "1234567890abcdefghijklmnopqrstuvwxyz\"!@#$%^&*()?"); assertEquals(MetaMap.decomposeToAscii("Ƣ"), ""); assertEquals(MetaMap.decomposeToAscii("ǽ"), "ae"); assertEquals(MetaMap.decomposeToAscii("Ǿ"), "O"); assertEquals(MetaMap.decomposeToAscii("ȶ"), "t"); }
public static String decomposeToAscii(final String s) { final char[] input = new char[s.length()]; s.getChars(0, s.length(), input, 0); final char[] output = new char[input.length * 4]; final int numChars = ASCIIFoldingFilter.foldToASCII(input, 0, output, 0, input.length); final StringBuilder sb = new StringBuilder(numChars); for (int i = 0; i < numChars; i++) { final char c = output[i]; if ((32 <= c && c <= 126) || '\n' == c) sb.append(c); } return sb.toString(); }
MetaMap { public static String decomposeToAscii(final String s) { final char[] input = new char[s.length()]; s.getChars(0, s.length(), input, 0); final char[] output = new char[input.length * 4]; final int numChars = ASCIIFoldingFilter.foldToASCII(input, 0, output, 0, input.length); final StringBuilder sb = new StringBuilder(numChars); for (int i = 0; i < numChars; i++) { final char c = output[i]; if ((32 <= c && c <= 126) || '\n' == c) sb.append(c); } return sb.toString(); } }
MetaMap { public static String decomposeToAscii(final String s) { final char[] input = new char[s.length()]; s.getChars(0, s.length(), input, 0); final char[] output = new char[input.length * 4]; final int numChars = ASCIIFoldingFilter.foldToASCII(input, 0, output, 0, input.length); final StringBuilder sb = new StringBuilder(numChars); for (int i = 0; i < numChars; i++) { final char c = output[i]; if ((32 <= c && c <= 126) || '\n' == c) sb.append(c); } return sb.toString(); } MetaMap(final File publicMm, final Collection<Option> opts); }
MetaMap { public static String decomposeToAscii(final String s) { final char[] input = new char[s.length()]; s.getChars(0, s.length(), input, 0); final char[] output = new char[input.length * 4]; final int numChars = ASCIIFoldingFilter.foldToASCII(input, 0, output, 0, input.length); final StringBuilder sb = new StringBuilder(numChars); for (int i = 0; i < numChars; i++) { final char c = output[i]; if ((32 <= c && c <= 126) || '\n' == c) sb.append(c); } return sb.toString(); } MetaMap(final File publicMm, final Collection<Option> opts); boolean process(final File input, final File output); static String decomposeToAscii(final String s); }
MetaMap { public static String decomposeToAscii(final String s) { final char[] input = new char[s.length()]; s.getChars(0, s.length(), input, 0); final char[] output = new char[input.length * 4]; final int numChars = ASCIIFoldingFilter.foldToASCII(input, 0, output, 0, input.length); final StringBuilder sb = new StringBuilder(numChars); for (int i = 0; i < numChars; i++) { final char c = output[i]; if ((32 <= c && c <= 126) || '\n' == c) sb.append(c); } return sb.toString(); } MetaMap(final File publicMm, final Collection<Option> opts); boolean process(final File input, final File output); static String decomposeToAscii(final String s);  }