Android examples for java.lang:String Unicode
remove from UTF16
/*//from w w w . j a v a 2 s.com ******************************************************************************* * Copyright (C) 1996-2015, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ import sun.text.normalizer.UTF16; import android.icu.text.UnicodeSet; public class Main { public static String remove(String source, UnicodeSet removals) { StringBuffer result = new StringBuffer(); int cp; for (int i = 0; i < source.length(); i += UTF16.getCharCount(cp)) { cp = UTF16.charAt(source, i); if (!removals.contains(cp)) UTF16.append(result, cp); } return result.toString(); } }