Fields Summary |
---|
private static final long | serialVersionUID |
private final char | value |
public static final char | MIN_VALUEThe minimum {@code Character} value. |
public static final char | MAX_VALUEThe maximum {@code Character} value. |
public static final int | MIN_RADIXThe minimum radix used for conversions between characters and integers. |
public static final int | MAX_RADIXThe maximum radix used for conversions between characters and integers. |
public static final Class | TYPEThe {@link Class} object that represents the primitive type {@code char}. |
public static final byte | UNASSIGNEDUnicode category constant Cn. |
public static final byte | UPPERCASE_LETTERUnicode category constant Lu. |
public static final byte | LOWERCASE_LETTERUnicode category constant Ll. |
public static final byte | TITLECASE_LETTERUnicode category constant Lt. |
public static final byte | MODIFIER_LETTERUnicode category constant Lm. |
public static final byte | OTHER_LETTERUnicode category constant Lo. |
public static final byte | NON_SPACING_MARKUnicode category constant Mn. |
public static final byte | ENCLOSING_MARKUnicode category constant Me. |
public static final byte | COMBINING_SPACING_MARKUnicode category constant Mc. |
public static final byte | DECIMAL_DIGIT_NUMBERUnicode category constant Nd. |
public static final byte | LETTER_NUMBERUnicode category constant Nl. |
public static final byte | OTHER_NUMBERUnicode category constant No. |
public static final byte | SPACE_SEPARATORUnicode category constant Zs. |
public static final byte | LINE_SEPARATORUnicode category constant Zl. |
public static final byte | PARAGRAPH_SEPARATORUnicode category constant Zp. |
public static final byte | CONTROLUnicode category constant Cc. |
public static final byte | FORMATUnicode category constant Cf. |
public static final byte | PRIVATE_USEUnicode category constant Co. |
public static final byte | SURROGATEUnicode category constant Cs. |
public static final byte | DASH_PUNCTUATIONUnicode category constant Pd. |
public static final byte | START_PUNCTUATIONUnicode category constant Ps. |
public static final byte | END_PUNCTUATIONUnicode category constant Pe. |
public static final byte | CONNECTOR_PUNCTUATIONUnicode category constant Pc. |
public static final byte | OTHER_PUNCTUATIONUnicode category constant Po. |
public static final byte | MATH_SYMBOLUnicode category constant Sm. |
public static final byte | CURRENCY_SYMBOLUnicode category constant Sc. |
public static final byte | MODIFIER_SYMBOLUnicode category constant Sk. |
public static final byte | OTHER_SYMBOLUnicode category constant So. |
public static final byte | INITIAL_QUOTE_PUNCTUATIONUnicode category constant Pi. |
public static final byte | FINAL_QUOTE_PUNCTUATIONUnicode category constant Pf. |
public static final byte | DIRECTIONALITY_UNDEFINEDUnicode bidirectional constant. |
public static final byte | DIRECTIONALITY_LEFT_TO_RIGHTUnicode bidirectional constant L. |
public static final byte | DIRECTIONALITY_RIGHT_TO_LEFTUnicode bidirectional constant R. |
public static final byte | DIRECTIONALITY_RIGHT_TO_LEFT_ARABICUnicode bidirectional constant AL. |
public static final byte | DIRECTIONALITY_EUROPEAN_NUMBERUnicode bidirectional constant EN. |
public static final byte | DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATORUnicode bidirectional constant ES. |
public static final byte | DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATORUnicode bidirectional constant ET. |
public static final byte | DIRECTIONALITY_ARABIC_NUMBERUnicode bidirectional constant AN. |
public static final byte | DIRECTIONALITY_COMMON_NUMBER_SEPARATORUnicode bidirectional constant CS. |
public static final byte | DIRECTIONALITY_NONSPACING_MARKUnicode bidirectional constant NSM. |
public static final byte | DIRECTIONALITY_BOUNDARY_NEUTRALUnicode bidirectional constant BN. |
public static final byte | DIRECTIONALITY_PARAGRAPH_SEPARATORUnicode bidirectional constant B. |
public static final byte | DIRECTIONALITY_SEGMENT_SEPARATORUnicode bidirectional constant S. |
public static final byte | DIRECTIONALITY_WHITESPACEUnicode bidirectional constant WS. |
public static final byte | DIRECTIONALITY_OTHER_NEUTRALSUnicode bidirectional constant ON. |
public static final byte | DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDINGUnicode bidirectional constant LRE. |
public static final byte | DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDEUnicode bidirectional constant LRO. |
public static final byte | DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDINGUnicode bidirectional constant RLE. |
public static final byte | DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDEUnicode bidirectional constant RLO. |
public static final byte | DIRECTIONALITY_POP_DIRECTIONAL_FORMATUnicode bidirectional constant PDF. |
public static final char | MIN_HIGH_SURROGATEThe minimum value of a high surrogate or leading surrogate unit in UTF-16
encoding, {@code '\uD800'}. |
public static final char | MAX_HIGH_SURROGATEThe maximum value of a high surrogate or leading surrogate unit in UTF-16
encoding, {@code '\uDBFF'}. |
public static final char | MIN_LOW_SURROGATEThe minimum value of a low surrogate or trailing surrogate unit in UTF-16
encoding, {@code '\uDC00'}. |
public static final char | MAX_LOW_SURROGATEThe maximum value of a low surrogate or trailing surrogate unit in UTF-16
encoding, {@code '\uDFFF'}. |
public static final char | MIN_SURROGATEThe minimum value of a surrogate unit in UTF-16 encoding, {@code '\uD800'}. |
public static final char | MAX_SURROGATEThe maximum value of a surrogate unit in UTF-16 encoding, {@code '\uDFFF'}. |
public static final int | MIN_SUPPLEMENTARY_CODE_POINTThe minimum value of a supplementary code point, {@code U+010000}. |
public static final int | MIN_CODE_POINTThe minimum code point value, {@code U+0000}. |
public static final int | MAX_CODE_POINTThe maximum code point value, {@code U+10FFFF}. |
public static final int | SIZEThe number of bits required to represent a {@code Character} value in
two's compliment form. |
private static final char[] | typeTags |
private static final byte[] | DIRECTIONALITY |
private static final int | ISJAVASTART |
private static final int | ISJAVAPART |
private static final int | CACHE_LEN |
Methods Summary |
---|
public static int | charCount(int codePoint)Calculates the number of {@code char} values required to represent the
specified Unicode code point. This method checks if the {@code codePoint}
is greater than or equal to {@code 0x10000}, in which case {@code 2} is
returned, otherwise {@code 1}. To test if the code point is valid, use
the {@link #isValidCodePoint(int)} method.
return (codePoint >= 0x10000 ? 2 : 1);
|
public char | charValue()Gets the primitive value of this character.
return value;
|
public static int | codePointAt(java.lang.CharSequence seq, int index)Returns the code point at {@code index} in the specified sequence of
character units. If the unit at {@code index} is a high-surrogate unit,
{@code index + 1} is less than the length of the sequence and the unit at
{@code index + 1} is a low-surrogate unit, then the supplementary code
point represented by the pair is returned; otherwise the {@code char}
value at {@code index} is returned.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length();
if (index < 0 || index >= len) {
throw new IndexOutOfBoundsException();
}
char high = seq.charAt(index++);
if (index >= len) {
return high;
}
char low = seq.charAt(index);
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return high;
|
public static int | codePointAt(char[] seq, int index)Returns the code point at {@code index} in the specified array of
character units. If the unit at {@code index} is a high-surrogate unit,
{@code index + 1} is less than the length of the array and the unit at
{@code index + 1} is a low-surrogate unit, then the supplementary code
point represented by the pair is returned; otherwise the {@code char}
value at {@code index} is returned.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length;
if (index < 0 || index >= len) {
throw new IndexOutOfBoundsException();
}
char high = seq[index++];
if (index >= len) {
return high;
}
char low = seq[index];
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return high;
|
public static int | codePointAt(char[] seq, int index, int limit)Returns the code point at {@code index} in the specified array of
character units, where {@code index} has to be less than {@code limit}.
If the unit at {@code index} is a high-surrogate unit, {@code index + 1}
is less than {@code limit} and the unit at {@code index + 1} is a
low-surrogate unit, then the supplementary code point represented by the
pair is returned; otherwise the {@code char} value at {@code index} is
returned.
if (index < 0 || index >= limit || limit < 0 || limit > seq.length) {
throw new IndexOutOfBoundsException();
}
char high = seq[index++];
if (index >= limit) {
return high;
}
char low = seq[index];
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return high;
|
public static int | codePointBefore(java.lang.CharSequence seq, int index)Returns the code point that preceds {@code index} in the specified
sequence of character units. If the unit at {@code index - 1} is a
low-surrogate unit, {@code index - 2} is not negative and the unit at
{@code index - 2} is a high-surrogate unit, then the supplementary code
point represented by the pair is returned; otherwise the {@code char}
value at {@code index - 1} is returned.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length();
if (index < 1 || index > len) {
throw new IndexOutOfBoundsException();
}
char low = seq.charAt(--index);
if (--index < 0) {
return low;
}
char high = seq.charAt(index);
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return low;
|
public static int | codePointBefore(char[] seq, int index)Returns the code point that preceds {@code index} in the specified
array of character units. If the unit at {@code index - 1} is a
low-surrogate unit, {@code index - 2} is not negative and the unit at
{@code index - 2} is a high-surrogate unit, then the supplementary code
point represented by the pair is returned; otherwise the {@code char}
value at {@code index - 1} is returned.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length;
if (index < 1 || index > len) {
throw new IndexOutOfBoundsException();
}
char low = seq[--index];
if (--index < 0) {
return low;
}
char high = seq[index];
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return low;
|
public static int | codePointBefore(char[] seq, int index, int start)Returns the code point that preceds the {@code index} in the specified
array of character units and is not less than {@code start}. If the unit
at {@code index - 1} is a low-surrogate unit, {@code index - 2} is not
less than {@code start} and the unit at {@code index - 2} is a
high-surrogate unit, then the supplementary code point represented by the
pair is returned; otherwise the {@code char} value at {@code index - 1}
is returned.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length;
if (index <= start || index > len || start < 0 || start >= len) {
throw new IndexOutOfBoundsException();
}
char low = seq[--index];
if (--index < start) {
return low;
}
char high = seq[index];
if (isSurrogatePair(high, low)) {
return toCodePoint(high, low);
}
return low;
|
public static int | codePointCount(java.lang.CharSequence seq, int beginIndex, int endIndex)Counts the number of Unicode code points in the subsequence of the
specified character sequence, as delineated by {@code beginIndex} and
{@code endIndex}. Any surrogate values with missing pair values will be
counted as one code point.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length();
if (beginIndex < 0 || endIndex > len || beginIndex > endIndex) {
throw new IndexOutOfBoundsException();
}
int result = 0;
for (int i = beginIndex; i < endIndex; i++) {
char c = seq.charAt(i);
if (isHighSurrogate(c)) {
if (++i < endIndex) {
c = seq.charAt(i);
if (!isLowSurrogate(c)) {
result++;
}
}
}
result++;
}
return result;
|
public static int | codePointCount(char[] seq, int offset, int count)Counts the number of Unicode code points in the subsequence of the
specified char array, as delineated by {@code offset} and {@code count}.
Any surrogate values with missing pair values will be counted as one code
point.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length;
int endIndex = offset + count;
if (offset < 0 || count < 0 || endIndex > len) {
throw new IndexOutOfBoundsException();
}
int result = 0;
for (int i = offset; i < endIndex; i++) {
char c = seq[i];
if (isHighSurrogate(c)) {
if (++i < endIndex) {
c = seq[i];
if (!isLowSurrogate(c)) {
result++;
}
}
}
result++;
}
return result;
|
public int | compareTo(java.lang.Character c)Compares this object to the specified character object to determine their
relative order.
return value - c.value;
|
public static int | digit(char c, int radix)Convenience method to determine the value of the specified character
{@code c} in the supplied radix. The value of {@code radix} must be
between MIN_RADIX and MAX_RADIX.
// BEGIN android-changed
// if (radix >= MIN_RADIX && radix <= MAX_RADIX) {
// if (c < 128) {
// // Optimized for ASCII
// int result = -1;
// if ('0' <= c && c <= '9') {
// result = c - '0';
// } else if ('a' <= c && c <= 'z') {
// result = c - ('a' - 10);
// } else if ('A' <= c && c <= 'Z') {
// result = c - ('A' - 10);
// }
// return result < radix ? result : -1;
// }
// int result = BinarySearch.binarySearchRange(digitKeys, c);
// if (result >= 0 && c <= digitValues[result * 2]) {
// int value = (char) (c - digitValues[result * 2 + 1]);
// if (value >= radix) {
// return -1;
// }
// return value;
// }
// }
// return -1;
return UCharacter.digit(c, radix);
// ENd android-changed
|
public static int | digit(int codePoint, int radix)Convenience method to determine the value of the character
{@code codePoint} in the supplied radix. The value of {@code radix} must
be between MIN_RADIX and MAX_RADIX.
return UCharacter.digit(codePoint, radix);
|
public boolean | equals(java.lang.Object object)Compares this object with the specified object and indicates if they are
equal. In order to be equal, {@code object} must be an instance of
{@code Character} and have the same char value as this object.
return (object instanceof Character)
&& (value == ((Character) object).value);
|
public static char | forDigit(int digit, int radix)Returns the character which represents the specified digit in the
specified radix. The {@code radix} must be between {@code MIN_RADIX} and
{@code MAX_RADIX} inclusive; {@code digit} must not be negative and
smaller than {@code radix}. If any of these conditions does not hold, 0
is returned.
if (MIN_RADIX <= radix && radix <= MAX_RADIX) {
if (0 <= digit && digit < radix) {
return (char) (digit < 10 ? digit + '0" : digit + 'a" - 10);
}
}
return 0;
|
public static byte | getDirectionality(char c)Gets the Unicode directionality of the specified character.
// BEGIN android-changed
// int result = BinarySearch.binarySearchRange(bidiKeys, c);
// int high = bidiValues[result * 2];
// if (c <= high) {
// int code = bidiValues[result * 2 + 1];
// if (code < 0x100) {
// return (byte) (code - 1);
// }
// return (byte) (((c & 1) == 1 ? code >> 8 : code & 0xff) - 1);
// }
// return DIRECTIONALITY_UNDEFINED;
return getDirectionality((int)c);
// END android-changed
|
public static byte | getDirectionality(int codePoint)Gets the Unicode directionality of the specified character.
if (getType(codePoint) == Character.UNASSIGNED) {
return Character.DIRECTIONALITY_UNDEFINED;
}
byte UCDirectionality = UCharacter.getDirectionality(codePoint);
if (UCDirectionality == -1) {
return -1;
}
return DIRECTIONALITY[UCDirectionality];
|
public static int | getNumericValue(char c)Gets the numeric value of the specified Unicode character.
// BEGIN android-changed
// if (c < 128) {
// // Optimized for ASCII
// if (c >= '0' && c <= '9') {
// return c - '0';
// }
// if (c >= 'a' && c <= 'z') {
// return c - ('a' - 10);
// }
// if (c >= 'A' && c <= 'Z') {
// return c - ('A' - 10);
// }
// return -1;
// }
// int result = BinarySearch.binarySearchRange(numericKeys, c);
// if (result >= 0 && c <= numericValues[result * 2]) {
// char difference = numericValues[result * 2 + 1];
// if (difference == 0) {
// return -2;
// }
// // Value is always positive, must be negative value
// if (difference > c) {
// return c - (short) difference;
// }
// return c - difference;
// }
// return -1;
return UCharacter.getNumericValue(c);
// END android-changed
|
public static int | getNumericValue(int codePoint)Gets the numeric value of the specified Unicode code point. For example,
the code point '\u216B' stands for the Roman number XII, which has the
numeric value 12.
return UCharacter.getNumericValue(codePoint);
|
public static int | getType(char c)Gets the general Unicode category of the specified character.
// BEGIN android-changed
// int result = BinarySearch.binarySearchRange(typeKeys, c);
// int high = typeValues[result * 2];
// if (c <= high) {
// int code = typeValues[result * 2 + 1];
// if (code < 0x100) {
// return code;
// }
// return (c & 1) == 1 ? code >> 8 : code & 0xff;
// }
// return UNASSIGNED;
return getType((int)c);
// END android-changed
|
public static int | getType(int codePoint)Gets the general Unicode category of the specified code point.
int type = UCharacter.getType(codePoint);
// the type values returned by UCharacter are not compatible with what
// the spec says.RI's Character type values skip the value 17.
if (type <= Character.FORMAT) {
return type;
}
return (type + 1);
|
public int | hashCode()
return value;
|
public static boolean | isDefined(char c)Indicates whether the specified character is defined in the Unicode
specification.
// BEGIN android-changed
// return getType(c) != UNASSIGNED;
return UCharacter.isDefined(c);
// END android-changed
|
public static boolean | isDefined(int codePoint)Indicates whether the specified code point is defined in the Unicode
specification.
return UCharacter.isDefined(codePoint);
|
public static boolean | isDigit(char c)Indicates whether the specified character is a digit.
// BEGIN android-changed
// // Optimized case for ASCII
// if ('0' <= c && c <= '9') {
// return true;
// }
// if (c < 1632) {
// return false;
// }
// return getType(c) == DECIMAL_DIGIT_NUMBER;
return UCharacter.isDigit(c);
// END android-changed
|
public static boolean | isDigit(int codePoint)Indicates whether the specified code point is a digit.
return UCharacter.isDigit(codePoint);
|
public static boolean | isHighSurrogate(char ch)Indicates whether {@code ch} is a high- (or leading-) surrogate code unit
that is used for representing supplementary characters in UTF-16
encoding.
return (MIN_HIGH_SURROGATE <= ch && MAX_HIGH_SURROGATE >= ch);
|
public static boolean | isISOControl(char c)Indicates whether the specified character is an ISO control character.
return isISOControl((int)c);
|
public static boolean | isISOControl(int c)Indicates whether the specified code point is an ISO control character.
return (c >= 0 && c <= 0x1f) || (c >= 0x7f && c <= 0x9f);
|
public static boolean | isIdentifierIgnorable(char c)Indicates whether the specified character is ignorable in a Java or
Unicode identifier.
// BEGIN android-changed
// return (c >= 0 && c <= 8) || (c >= 0xe && c <= 0x1b)
// || (c >= 0x7f && c <= 0x9f) || getType(c) == FORMAT;
return UCharacter.isIdentifierIgnorable(c);
// END android-changed
|
public static boolean | isIdentifierIgnorable(int codePoint)Indicates whether the specified code point is ignorable in a Java or
Unicode identifier.
return UCharacter.isIdentifierIgnorable(codePoint);
|
public static boolean | isJavaIdentifierPart(char c)Indicates whether the specified character is a valid part of a Java
identifier other than the first character.
// Optimized case for ASCII
if (c < 128) {
return (typeTags[c] & ISJAVAPART) != 0;
}
int type = getType(c);
return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
|| type == CURRENCY_SYMBOL || type == CONNECTOR_PUNCTUATION
|| (type >= DECIMAL_DIGIT_NUMBER && type <= LETTER_NUMBER)
|| type == NON_SPACING_MARK || type == COMBINING_SPACING_MARK
|| (c >= 0x80 && c <= 0x9f) || type == FORMAT;
|
public static boolean | isJavaIdentifierPart(int codePoint)Indicates whether the specified code point is a valid part of a Java
identifier other than the first character.
int type = getType(codePoint);
return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
|| type == CURRENCY_SYMBOL || type == CONNECTOR_PUNCTUATION
|| (type >= DECIMAL_DIGIT_NUMBER && type <= LETTER_NUMBER)
|| type == COMBINING_SPACING_MARK || type == NON_SPACING_MARK
|| isIdentifierIgnorable(codePoint);
|
public static boolean | isJavaIdentifierStart(char c)Indicates whether the specified character is a valid first character for
a Java identifier.
// Optimized case for ASCII
if (c < 128) {
return (typeTags[c] & ISJAVASTART) != 0;
}
int type = getType(c);
return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
|| type == CURRENCY_SYMBOL || type == CONNECTOR_PUNCTUATION
|| type == LETTER_NUMBER;
|
public static boolean | isJavaIdentifierStart(int codePoint)Indicates whether the specified code point is a valid start for a Java
identifier.
int type = getType(codePoint);
return isLetter(codePoint) || type == CURRENCY_SYMBOL
|| type == CONNECTOR_PUNCTUATION || type == LETTER_NUMBER;
|
public static boolean | isJavaLetter(char c)Indicates whether the specified character is a Java letter.
return isJavaIdentifierStart(c);
|
public static boolean | isJavaLetterOrDigit(char c)Indicates whether the specified character is a Java letter or digit
character.
return isJavaIdentifierPart(c);
|
public static boolean | isLetter(char c)Indicates whether the specified character is a letter.
// BEGIN android-changed
// if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) {
// return true;
// }
// if (c < 128) {
// return false;
// }
// int type = getType(c);
// return type >= UPPERCASE_LETTER && type <= OTHER_LETTER;
return UCharacter.isLetter(c);
// END android-changed
|
public static boolean | isLetter(int codePoint)Indicates whether the specified code point is a letter.
return UCharacter.isLetter(codePoint);
|
public static boolean | isLetterOrDigit(char c)Indicates whether the specified character is a letter or a digit.
// BEGIN android-changed
// int type = getType(c);
// return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
// || type == DECIMAL_DIGIT_NUMBER;
return UCharacter.isLetterOrDigit(c);
// END andorid-changed
|
public static boolean | isLetterOrDigit(int codePoint)Indicates whether the specified code point is a letter or a digit.
return UCharacter.isLetterOrDigit(codePoint);
|
public static boolean | isLowSurrogate(char ch)Indicates whether {@code ch} is a low- (or trailing-) surrogate code unit
that is used for representing supplementary characters in UTF-16
encoding.
return (MIN_LOW_SURROGATE <= ch && MAX_LOW_SURROGATE >= ch);
|
public static boolean | isLowerCase(char c)Indicates whether the specified character is a lower case letter.
// BEGIN android-changed
// // Optimized case for ASCII
// if ('a' <= c && c <= 'z') {
// return true;
// }
// if (c < 128) {
// return false;
// }
//
// return getType(c) == LOWERCASE_LETTER;
return UCharacter.isLowerCase(c);
// END android-changed
|
public static boolean | isLowerCase(int codePoint)Indicates whether the specified code point is a lower case letter.
return UCharacter.isLowerCase(codePoint);
|
public static boolean | isMirrored(char c)Indicates whether the specified character is mirrored.
// BEGIN android-changed
// int value = c / 16;
// if (value >= mirrored.length) {
// return false;
// }
// int bit = 1 << (c % 16);
// return (mirrored[value] & bit) != 0;
return isMirrored((int)c);
// ENd android-changed
|
public static boolean | isMirrored(int codePoint)Indicates whether the specified code point is mirrored.
return UCharacter.isMirrored(codePoint);
|
public static boolean | isSpace(char c)Indicates whether the specified character is a Java space.
return c == '\n" || c == '\t" || c == '\f" || c == '\r" || c == ' ";
|
public static boolean | isSpaceChar(char c)Indicates whether the specified character is a Unicode space character.
That is, if it is a member of one of the Unicode categories Space
Separator, Line Separator, or Paragraph Separator.
// BEGIN android-changed
// if (c == 0x20 || c == 0xa0 || c == 0x1680) {
// return true;
// }
// if (c < 0x2000) {
// return false;
// }
// return c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x202f
// || c == 0x3000;
return UCharacter.isSpaceChar(c);
// END android-changed
|
public static boolean | isSpaceChar(int codePoint)Indicates whether the specified code point is a Unicode space character.
That is, if it is a member of one of the Unicode categories Space
Separator, Line Separator, or Paragraph Separator.
return UCharacter.isSpaceChar(codePoint);
|
public static boolean | isSupplementaryCodePoint(int codePoint)Indicates whether {@code codePoint} is within the supplementary code
point range.
return (MIN_SUPPLEMENTARY_CODE_POINT <= codePoint && MAX_CODE_POINT >= codePoint);
|
public static boolean | isSurrogatePair(char high, char low)Indicates whether the specified character pair is a valid surrogate pair.
return (isHighSurrogate(high) && isLowSurrogate(low));
|
public static boolean | isTitleCase(char c)Indicates whether the specified character is a titlecase character.
// BEGIN android-changed
// if (c == '\u01c5' || c == '\u01c8' || c == '\u01cb' || c == '\u01f2') {
// return true;
// }
// if (c >= '\u1f88' && c <= '\u1ffc') {
// // 0x1f88 - 0x1f8f, 0x1f98 - 0x1f9f, 0x1fa8 - 0x1faf
// if (c > '\u1faf') {
// return c == '\u1fbc' || c == '\u1fcc' || c == '\u1ffc';
// }
// int last = c & 0xf;
// return last >= 8 && last <= 0xf;
// }
// return false;
return UCharacter.isTitleCase(c);
// END android-changed
|
public static boolean | isTitleCase(int codePoint)Indicates whether the specified code point is a titlecase character.
return UCharacter.isTitleCase(codePoint);
|
public static boolean | isUnicodeIdentifierPart(char c)Indicates whether the specified character is valid as part of a Unicode
identifier other than the first character.
// BEGIN android-changed
// int type = getType(c);
// return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
// || type == CONNECTOR_PUNCTUATION
// || (type >= DECIMAL_DIGIT_NUMBER && type <= LETTER_NUMBER)
// || type == NON_SPACING_MARK || type == COMBINING_SPACING_MARK
// || isIdentifierIgnorable(c);
return UCharacter.isUnicodeIdentifierPart(c);
// END android-changed
|
public static boolean | isUnicodeIdentifierPart(int codePoint)Indicates whether the specified code point is valid as part of a Unicode
identifier other than the first character.
return UCharacter.isUnicodeIdentifierPart(codePoint);
|
public static boolean | isUnicodeIdentifierStart(char c)Indicates whether the specified character is a valid initial character
for a Unicode identifier.
// BEGIN android-changed
// int type = getType(c);
// return (type >= UPPERCASE_LETTER && type <= OTHER_LETTER)
// || type == LETTER_NUMBER;
return UCharacter.isUnicodeIdentifierStart(c);
// END android-changed
|
public static boolean | isUnicodeIdentifierStart(int codePoint)Indicates whether the specified code point is a valid initial character
for a Unicode identifier.
return UCharacter.isUnicodeIdentifierStart(codePoint);
|
public static boolean | isUpperCase(char c)Indicates whether the specified character is an upper case letter.
// BEGIN android-changed
// // Optimized case for ASCII
// if ('A' <= c && c <= 'Z') {
// return true;
// }
// if (c < 128) {
// return false;
// }
//
// return getType(c) == UPPERCASE_LETTER;
return UCharacter.isUpperCase(c);
// END android-changed
|
public static boolean | isUpperCase(int codePoint)Indicates whether the specified code point is an upper case letter.
return UCharacter.isUpperCase(codePoint);
|
public static boolean | isValidCodePoint(int codePoint)Indicates whether {@code codePoint} is a valid Unicode code point.
for(int i=0; i<CACHE.length; i++){
CACHE[i] = new Character((char)i);
}
return (MIN_CODE_POINT <= codePoint && MAX_CODE_POINT >= codePoint);
|
public static boolean | isWhitespace(char c)Indicates whether the specified character is a whitespace character in
Java.
// BEGIN android-changed
// // Optimized case for ASCII
// if ((c >= 0x1c && c <= 0x20) || (c >= 0x9 && c <= 0xd)) {
// return true;
// }
// if (c == 0x1680) {
// return true;
// }
// if (c < 0x2000 || c == 0x2007) {
// return false;
// }
// return c <= 0x200b || c == 0x2028 || c == 0x2029 || c == 0x3000;
return UCharacter.isWhitespace(c);
// END android-changed
|
public static boolean | isWhitespace(int codePoint)Indicates whether the specified code point is a whitespace character in
Java.
//FIXME depends on ICU when the codePoint is '\u2007'
return UCharacter.isWhitespace(codePoint);
|
public static int | offsetByCodePoints(java.lang.CharSequence seq, int index, int codePointOffset)Determines the index in the specified character sequence that is offset
{@code codePointOffset} code points from {@code index}.
if (seq == null) {
throw new NullPointerException();
}
int len = seq.length();
if (index < 0 || index > len) {
throw new IndexOutOfBoundsException();
}
if (codePointOffset == 0) {
return index;
}
if (codePointOffset > 0) {
int codePoints = codePointOffset;
int i = index;
while (codePoints > 0) {
codePoints--;
if (i >= len) {
throw new IndexOutOfBoundsException();
}
if (isHighSurrogate(seq.charAt(i))) {
int next = i + 1;
if (next < len && isLowSurrogate(seq.charAt(next))) {
i++;
}
}
i++;
}
return i;
}
assert codePointOffset < 0;
int codePoints = -codePointOffset;
int i = index;
while (codePoints > 0) {
codePoints--;
i--;
if (i < 0) {
throw new IndexOutOfBoundsException();
}
if (isLowSurrogate(seq.charAt(i))) {
int prev = i - 1;
if (prev >= 0 && isHighSurrogate(seq.charAt(prev))) {
i--;
}
}
}
return i;
|
public static int | offsetByCodePoints(char[] seq, int start, int count, int index, int codePointOffset)Determines the index in a subsequence of the specified character array
that is offset {@code codePointOffset} code points from {@code index}.
The subsequence is delineated by {@code start} and {@code count}.
if (seq == null) {
throw new NullPointerException();
}
int end = start + count;
if (start < 0 || count < 0 || end > seq.length || index < start
|| index > end) {
throw new IndexOutOfBoundsException();
}
if (codePointOffset == 0) {
return index;
}
if (codePointOffset > 0) {
int codePoints = codePointOffset;
int i = index;
while (codePoints > 0) {
codePoints--;
if (i >= end) {
throw new IndexOutOfBoundsException();
}
if (isHighSurrogate(seq[i])) {
int next = i + 1;
if (next < end && isLowSurrogate(seq[next])) {
i++;
}
}
i++;
}
return i;
}
assert codePointOffset < 0;
int codePoints = -codePointOffset;
int i = index;
while (codePoints > 0) {
codePoints--;
i--;
if (i < start) {
throw new IndexOutOfBoundsException();
}
if (isLowSurrogate(seq[i])) {
int prev = i - 1;
if (prev >= start && isHighSurrogate(seq[prev])) {
i--;
}
}
}
return i;
|
public static char | reverseBytes(char c)Reverses the order of the first and second byte in the specified
character.
return (char)((c<<8) | (c>>8));
|
public static int | toChars(int codePoint, char[] dst, int dstIndex)Converts the specified Unicode code point into a UTF-16 encoded sequence
and copies the value(s) into the char array {@code dst}, starting at
index {@code dstIndex}.
if (!isValidCodePoint(codePoint)) {
throw new IllegalArgumentException();
}
if (dst == null) {
throw new NullPointerException();
}
if (dstIndex < 0 || dstIndex >= dst.length) {
throw new IndexOutOfBoundsException();
}
if (isSupplementaryCodePoint(codePoint)) {
if (dstIndex == dst.length - 1) {
throw new IndexOutOfBoundsException();
}
// See RFC 2781, Section 2.1
// http://www.faqs.org/rfcs/rfc2781.html
int cpPrime = codePoint - 0x10000;
int high = 0xD800 | ((cpPrime >> 10) & 0x3FF);
int low = 0xDC00 | (cpPrime & 0x3FF);
dst[dstIndex] = (char) high;
dst[dstIndex + 1] = (char) low;
return 2;
}
dst[dstIndex] = (char) codePoint;
return 1;
|
public static char[] | toChars(int codePoint)Converts the specified Unicode code point into a UTF-16 encoded sequence
and returns it as a char array.
if (!isValidCodePoint(codePoint)) {
throw new IllegalArgumentException();
}
if (isSupplementaryCodePoint(codePoint)) {
int cpPrime = codePoint - 0x10000;
int high = 0xD800 | ((cpPrime >> 10) & 0x3FF);
int low = 0xDC00 | (cpPrime & 0x3FF);
return new char[] { (char) high, (char) low };
}
return new char[] { (char) codePoint };
|
public static int | toCodePoint(char high, char low)Converts a surrogate pair into a Unicode code point. This method assumes
that the pair are valid surrogates. If the pair are not valid
surrogates, then the result is indeterminate. The
{@link #isSurrogatePair(char, char)} method should be used prior to this
method to validate the pair.
// See RFC 2781, Section 2.2
// http://www.faqs.org/rfcs/rfc2781.html
int h = (high & 0x3FF) << 10;
int l = low & 0x3FF;
return (h | l) + 0x10000;
|
public static char | toLowerCase(char c)Returns the lower case equivalent for the specified character if the
character is an upper case letter. Otherwise, the specified character is
returned unchanged.
// BEGIN android-changed
// // Optimized case for ASCII
// if ('A' <= c && c <= 'Z') {
// return (char) (c + ('a' - 'A'));
// }
// if (c < 128) {
// return c;
// }
//
// int result = BinarySearch.binarySearchRange(lowercaseKeys, c);
// if (result >= 0) {
// boolean by2 = false;
// char start = lowercaseKeys.charAt(result);
// char end = lowercaseValues[result * 2];
// if ((start & 0x8000) != (end & 0x8000)) {
// end ^= 0x8000;
// by2 = true;
// }
// if (c <= end) {
// if (by2 && (c & 1) != (start & 1)) {
// return c;
// }
// char mapping = lowercaseValues[result * 2 + 1];
// return (char) (c + mapping);
// }
// }
// return c;
return (char)UCharacter.toLowerCase(c);
// END android-changed
|
public static int | toLowerCase(int codePoint)Returns the lower case equivalent for the specified code point if it is
an upper case letter. Otherwise, the specified code point is returned
unchanged.
return UCharacter.toLowerCase(codePoint);
|
public java.lang.String | toString()
return String.valueOf(value);
|
public static java.lang.String | toString(char value)Converts the specified character to its string representation.
return String.valueOf(value);
|
public static char | toTitleCase(char c)Returns the title case equivalent for the specified character if it
exists. Otherwise, the specified character is returned unchanged.
// BEGIN android-changed
// if (isTitleCase(c)) {
// return c;
// }
// int result = BinarySearch.binarySearch(titlecaseKeys, c);
// if (result >= 0) {
// return titlecaseValues[result];
// }
// return toUpperCase(c);
return (char)UCharacter.toTitleCase(c);
// ENd android-changed
|
public static int | toTitleCase(int codePoint)Returns the title case equivalent for the specified code point if it
exists. Otherwise, the specified code point is returned unchanged.
return UCharacter.toTitleCase(codePoint);
|
public static char | toUpperCase(char c)Returns the upper case equivalent for the specified character if the
character is a lower case letter. Otherwise, the specified character is
returned unchanged.
// BEGIN android-changed
// // Optimized case for ASCII
// if ('a' <= c && c <= 'z') {
// return (char) (c - ('a' - 'A'));
// }
// if (c < 128) {
// return c;
// }
//
// int result = BinarySearch.binarySearchRange(uppercaseKeys, c);
// if (result >= 0) {
// boolean by2 = false;
// char start = uppercaseKeys.charAt(result);
// char end = uppercaseValues[result * 2];
// if ((start & 0x8000) != (end & 0x8000)) {
// end ^= 0x8000;
// by2 = true;
// }
// if (c <= end) {
// if (by2 && (c & 1) != (start & 1)) {
// return c;
// }
// char mapping = uppercaseValues[result * 2 + 1];
// return (char) (c + mapping);
// }
// }
// return c;
return (char)UCharacter.toUpperCase(c);
// END android-changed
|
public static int | toUpperCase(int codePoint)Returns the upper case equivalent for the specified code point if the
code point is a lower case letter. Otherwise, the specified code point is
returned unchanged.
return UCharacter.toUpperCase(codePoint);
|
public static java.lang.Character | valueOf(char c)Returns a {@code Character} instance for the {@code char} value passed.
For ASCII/Latin-1 characters (and generally all characters with a Unicode
value up to 512), this method should be used instead of the constructor,
as it maintains a cache of corresponding {@code Character} instances.
if (c >= CACHE_LEN ) {
return new Character(c);
}
return valueOfCache.CACHE[c];
|