Android Utililty Methods Char Value Check

List of utility methods to do Char Value Check

Description

The list of methods to do Char Value Check are organized into topic(s).

Method

booleanisWhitespace(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;
booleanisLetter(char c)
is Letter
int k = 0x80;
return c / k == 0 ? true : false;
booleanisOctal(char c)
is Octal
return (c >= '0') && (c <= '7');
booleanisWordSeparator(char c)
is Word Separator
for (int i = 0; i < WORD_SEPARATORS.length; i++) {
    if (WORD_SEPARATORS[i] == c) {
        return true;
return false;
booleanisKana(char character)
is Kana
int charCode = (int) character;
return (charCode > 12352 && charCode < 12438)
        || (charCode > 12449 && charCode < 12538);
booleanisWordSeparator(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;
intgetSpecialCharLength(char c)
get Special Char Length
if (isLetter(c)) {
    return 1;
} else {
    return 2;
intgetCharsLength(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 {
...
intgetNthIndexOf(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;
intdisplayWidth(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') || 
...