Android examples for java.lang:Character
filter UCS4 via Character.isSupplementaryCodePoint
import android.text.TextUtils; import java.util.Locale; import java.util.UUID; public class Main{ public static final String filterUCS4(String str) { if (TextUtils.isEmpty(str)) { return str; }/*from w w w.ja v a2s . com*/ if (str.codePointCount(0, str.length()) == str.length()) { return str; } StringBuilder sb = new StringBuilder(); int index = 0; while (index < str.length()) { int codePoint = str.codePointAt(index); index += Character.charCount(codePoint); if (Character.isSupplementaryCodePoint(codePoint)) { continue; } sb.appendCodePoint(codePoint); } return sb.toString(); } }