Android examples for java.lang:String Unicode
get String Length for unicode string
public class Main{ public static int getStringLength(String s) { char[] chs = s.toCharArray(); int count = 0; for (int i = 0; i < chs.length; i++) { if ((chs[i] + "").getBytes().length >= 2) { count += 2;/*from w w w .j a va 2 s . c o m*/ } else { count++; } } return count; } }