Android examples for java.lang:String Unicode
Convert string to Code Point Array
import android.text.TextUtils; import java.util.ArrayList; import java.util.Locale; public class Main{ public static int[] toCodePointArray(final String string) { final char[] characters = string.toCharArray(); final int length = characters.length; final int[] codePoints = new int[Character.codePointCount( characters, 0, length)]; int codePoint = Character.codePointAt(characters, 0); int dsti = 0; for (int srci = Character.charCount(codePoint); srci < length; srci += Character .charCount(codePoint), ++dsti) { codePoints[dsti] = codePoint; codePoint = Character.codePointAt(characters, srci); }//from w ww .ja v a2s. c om codePoints[dsti] = codePoint; return codePoints; } }