List of utility methods to do Char Value Check
boolean | isWhitespace(char ch) Returns true if the specified character is a whitespace character (CR, LF, SP or HT).
return ch == SP || ch == HT || ch == CR || ch == LF;
|
boolean | isLetter(char c) is Letter int k = 0x80; return c / k == 0 ? true : false; |
boolean | isOctal(char c) is Octal return (c >= '0') && (c <= '7'); |
boolean | isWordSeparator(char c) is Word Separator for (int i = 0; i < WORD_SEPARATORS.length; i++) { if (WORD_SEPARATORS[i] == c) { return true; return false; |
boolean | isKana(char character) is Kana int charCode = (int) character; return (charCode > 12352 && charCode < 12438) || (charCode > 12449 && charCode < 12538); |
boolean | isWordSeparator(char c, char[] wordSeparators) is Word Separator if (wordSeparators == null) { return false; for (int i = 0; i < wordSeparators.length; i++) { if (wordSeparators[i] == c) { return true; return false; |
int | getSpecialCharLength(char c) get Special Char Length if (isLetter(c)) { return 1; } else { return 2; |
int | getCharsLength(char[] chars, int specialCharsLength) get Chars Length int count = 0; int normalCharsLength = 0; for (int i = 0; i < chars.length; i++) { int specialCharLength = getSpecialCharLength(chars[i]); if (count <= specialCharsLength - specialCharLength) { count += specialCharLength; normalCharsLength++; } else { ... |
int | getNthIndexOf(char c, String str, int n) find the nth index of a char c in a string. if (n < 1) { throw new IllegalArgumentException("n must be >= 1: " + n); int index = str.indexOf(c); int count = 0; while (index != -1 && (++count) < n) { index = str.indexOf(c, index + 1); return index; |
int | displayWidth(char ch) Returns the approximate display width of the character, measured in units of ascii characters. if (ch <= '\u04f9' || ch == '\u05be' || (ch >= '\u05d0' && ch <= '\u05ea') || ch == '\u05F3' || ch == '\u05f4' || (ch >= '\u0600' && ch <= '\u06ff') || (ch >= '\u0750' && ch <= '\u077f') || (ch >= '\ufb50' && ch <= '\ufdff') || ... |