List of usage examples for java.lang Character codePointAt
public static int codePointAt(char[] a, int index)
From source file:org.opencron.common.utils.StringUtils.java
/** * ?schar//from ww w . j a va 2 s. c o m * * @param s * @return */ public static int getWordCount(String s) { int length = 0; for (int i = 0; i < s.length(); i++) { int ascii = Character.codePointAt(s, i); if (ascii >= 0 && ascii <= 255) length++; else length += 2; } return length; }