public final class Character extends Object implements Serializable, Comparable<Character>
For predicates, boundaries are used to describe the set of characters for which the method will return true. This syntax uses fairly normal regular expression notation. See 5.13 of the Unicode Standard, Version 4.0, for the boundary specification.
See http://www.unicode.org for more information on the Unicode Standard.
Modifier and Type | Class and Description |
---|---|
static class |
Character.Subset
A subset of Unicode blocks.
|
static class |
Character.UnicodeBlock
A family of character subsets in the Unicode specification.
|
Modifier and Type | Field and Description |
---|---|
static byte |
COMBINING_SPACING_MARK
Mc = Mark, Spacing Combining (Normative).
|
static byte |
CONNECTOR_PUNCTUATION
Pc = Punctuation, Connector (Informative).
|
static byte |
CONTROL
Cc = Other, Control (Normative).
|
static byte |
CURRENCY_SYMBOL
Sc = Symbol, Currency (Informative).
|
static byte |
DASH_PUNCTUATION
Pd = Punctuation, Dash (Informative).
|
static byte |
DECIMAL_DIGIT_NUMBER
Nd = Number, Decimal Digit (Normative).
|
static byte |
DIRECTIONALITY_ARABIC_NUMBER
Weak bidirectional character type "AN".
|
static byte |
DIRECTIONALITY_BOUNDARY_NEUTRAL
Weak bidirectional character type "BN".
|
static byte |
DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
Weak bidirectional character type "CS".
|
static byte |
DIRECTIONALITY_EUROPEAN_NUMBER
Weak bidirectional character type "EN".
|
static byte |
DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
Weak bidirectional character type "ES".
|
static byte |
DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
Weak bidirectional character type "ET".
|
static byte |
DIRECTIONALITY_LEFT_TO_RIGHT
Strong bidirectional character type "L".
|
static byte |
DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
Strong bidirectional character type "LRE".
|
static byte |
DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
Strong bidirectional character type "LRO".
|
static byte |
DIRECTIONALITY_NONSPACING_MARK
Weak bidirectional character type "NSM".
|
static byte |
DIRECTIONALITY_OTHER_NEUTRALS
Neutral bidirectional character type "ON".
|
static byte |
DIRECTIONALITY_PARAGRAPH_SEPARATOR
Neutral bidirectional character type "B".
|
static byte |
DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
Weak bidirectional character type "PDF".
|
static byte |
DIRECTIONALITY_RIGHT_TO_LEFT
Strong bidirectional character type "R".
|
static byte |
DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
Strong bidirectional character type "AL".
|
static byte |
DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
Strong bidirectional character type "RLE".
|
static byte |
DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
Strong bidirectional character type "RLO".
|
static byte |
DIRECTIONALITY_SEGMENT_SEPARATOR
Neutral bidirectional character type "S".
|
static byte |
DIRECTIONALITY_UNDEFINED
Undefined bidirectional character type.
|
static byte |
DIRECTIONALITY_WHITESPACE
Strong bidirectional character type "WS".
|
static byte |
ENCLOSING_MARK
Me = Mark, Enclosing (Normative).
|
static byte |
END_PUNCTUATION
Pe = Punctuation, Close (Informative).
|
static byte |
FINAL_QUOTE_PUNCTUATION
Pf = Punctuation, Final Quote (Informative).
|
static byte |
FORMAT
Cf = Other, Format (Normative).
|
static byte |
INITIAL_QUOTE_PUNCTUATION
Pi = Punctuation, Initial Quote (Informative).
|
static byte |
LETTER_NUMBER
Nl = Number, Letter (Normative).
|
static byte |
LINE_SEPARATOR
Zl = Separator, Line (Normative).
|
static byte |
LOWERCASE_LETTER
Ll = Letter, Lowercase (Informative).
|
static byte |
MATH_SYMBOL
Sm = Symbol, Math (Informative).
|
static int |
MAX_CODE_POINT
The maximum Unicode 4.0 code point, which is greater than the range
of the char data type.
|
static char |
MAX_HIGH_SURROGATE
The maximum Unicode high surrogate code unit, or
|
static char |
MAX_LOW_SURROGATE
The maximum Unicode low surrogate code unit, or
|
static int |
MAX_RADIX
Largest value allowed for radix arguments in Java.
|
static char |
MAX_SURROGATE
The maximum Unicode surrogate code unit in the UTF-16 character encoding.
|
static char |
MAX_VALUE
The maximum value the char data type can hold.
|
static int |
MIN_CODE_POINT
The minimum Unicode 4.0 code point.
|
static char |
MIN_HIGH_SURROGATE
The minimum Unicode high surrogate code unit, or
|
static char |
MIN_LOW_SURROGATE
The minimum Unicode low surrogate code unit, or
|
static int |
MIN_RADIX
Smallest value allowed for radix arguments in Java.
|
static int |
MIN_SUPPLEMENTARY_CODE_POINT
The lowest possible supplementary Unicode code point (the first code
point outside the basic multilingual plane (BMP)).
|
static char |
MIN_SURROGATE
The minimum Unicode surrogate code unit in the UTF-16 character encoding.
|
static char |
MIN_VALUE
The minimum value the char data type can hold.
|
static byte |
MODIFIER_LETTER
Lm = Letter, Modifier (Informative).
|
static byte |
MODIFIER_SYMBOL
Sk = Symbol, Modifier (Informative).
|
static byte |
NON_SPACING_MARK
Mn = Mark, Non-Spacing (Normative).
|
static byte |
OTHER_LETTER
Lo = Letter, Other (Informative).
|
static byte |
OTHER_NUMBER
No = Number, Other (Normative).
|
static byte |
OTHER_PUNCTUATION
Po = Punctuation, Other (Informative).
|
static byte |
OTHER_SYMBOL
So = Symbol, Other (Informative).
|
static byte |
PARAGRAPH_SEPARATOR
Zp = Separator, Paragraph (Normative).
|
static byte |
PRIVATE_USE
Co = Other, Private Use (Normative).
|
static int |
SIZE
The number of bits needed to represent a
char . |
static byte |
SPACE_SEPARATOR
Zs = Separator, Space (Normative).
|
static byte |
START_PUNCTUATION
Ps = Punctuation, Open (Informative).
|
static byte |
SURROGATE
Cs = Other, Surrogate (Normative).
|
static byte |
TITLECASE_LETTER
Lt = Letter, Titlecase (Informative).
|
static Class<Character> |
TYPE
Class object representing the primitive char data type.
|
static byte |
UNASSIGNED
Cn = Other, Not Assigned (Normative).
|
static byte |
UPPERCASE_LETTER
Lu = Letter, Uppercase (Informative).
|
Constructor and Description |
---|
Character(char value)
Wraps up a character.
|
Modifier and Type | Method and Description |
---|---|
static int |
charCount(int codePoint)
Return number of 16-bit characters required to represent the given
code point.
|
char |
charValue()
Returns the character which has been wrapped by this class.
|
static int |
codePointAt(char[] chars,
int index)
Get the code point at the specified index in the CharSequence.
|
static int |
codePointAt(char[] chars,
int index,
int limit)
Get the code point at the specified index in the CharSequence.
|
static int |
codePointAt(CharSequence sequence,
int index)
Get the code point at the specified index in the CharSequence.
|
static int |
codePointBefore(char[] chars,
int index)
Get the code point before the specified index.
|
static int |
codePointBefore(char[] chars,
int index,
int start)
Get the code point before the specified index.
|
static int |
codePointBefore(CharSequence sequence,
int index)
Get the code point before the specified index.
|
static int |
codePointCount(char[] a,
int offset,
int count)
Returns the number of Unicode code points in the specified range of the
given char array.
|
static int |
codePointCount(CharSequence seq,
int beginIndex,
int endIndex)
Returns the number of Unicode code points in the specified range of the
given CharSequence.
|
int |
compareTo(Character anotherCharacter)
Compares another Character to this Character, numerically.
|
static int |
digit(char ch,
int radix)
Converts a character into a digit of the specified radix.
|
static int |
digit(int codePoint,
int radix)
Converts a character into a digit of the specified radix.
|
boolean |
equals(Object o)
Determines if an object is equal to this object.
|
static char |
forDigit(int digit,
int radix)
Converts a digit into a character which represents that digit
in a specified radix.
|
static byte |
getDirectionality(char ch)
Returns the Unicode directionality property of the character.
|
static byte |
getDirectionality(int codePoint)
Returns the Unicode directionality property of the character.
|
static int |
getNumericValue(char ch)
Returns the Unicode numeric value property of a character.
|
static int |
getNumericValue(int codePoint)
Returns the Unicode numeric value property of a character.
|
static int |
getType(char ch)
Returns the Unicode general category property of a character.
|
static int |
getType(int codePoint)
Returns the Unicode general category property of a character.
|
int |
hashCode()
Returns the numerical value (unsigned) of the wrapped character.
|
static boolean |
isDefined(char ch)
Determines if a character is part of the Unicode Standard.
|
static boolean |
isDefined(int codePoint)
Determines if a character is part of the Unicode Standard.
|
static boolean |
isDigit(char ch)
Determines if a character is a Unicode decimal digit.
|
static boolean |
isDigit(int codePoint)
Determines if a character is a Unicode decimal digit.
|
static boolean |
isHighSurrogate(char ch)
Return true if the given character is a high surrogate.
|
static boolean |
isIdentifierIgnorable(char ch)
Determines if a character is ignorable in a Unicode identifier.
|
static boolean |
isIdentifierIgnorable(int codePoint)
Determines if a character is ignorable in a Unicode identifier.
|
static boolean |
isISOControl(char ch)
Determines if a character has the ISO Control property.
|
static boolean |
isISOControl(int codePoint)
Determines if a character has the ISO Control property.
|
static boolean |
isJavaIdentifierPart(char ch)
Determines if a character can follow the first letter in
a Java identifier.
|
static boolean |
isJavaIdentifierPart(int codePoint)
Determines if a character can follow the first letter in
a Java identifier.
|
static boolean |
isJavaIdentifierStart(char ch)
Determines if a character can start a Java identifier.
|
static boolean |
isJavaIdentifierStart(int codePoint)
Determines if a character can start a Java identifier.
|
static boolean |
isJavaLetter(char ch)
Deprecated.
Replaced by
isJavaIdentifierStart(char) |
static boolean |
isJavaLetterOrDigit(char ch)
Deprecated.
Replaced by
isJavaIdentifierPart(char) |
static boolean |
isLetter(char ch)
Determines if a character is a Unicode letter.
|
static boolean |
isLetter(int codePoint)
Determines if a character is a Unicode letter.
|
static boolean |
isLetterOrDigit(char ch)
Determines if a character is a Unicode letter or a Unicode digit.
|
static boolean |
isLetterOrDigit(int codePoint)
Determines if a character is a Unicode letter or a Unicode digit.
|
static boolean |
isLowerCase(char ch)
Determines if a character is a Unicode lowercase letter.
|
static boolean |
isLowerCase(int codePoint)
Determines if a character is a Unicode lowercase letter.
|
static boolean |
isLowSurrogate(char ch)
Return true if the given character is a low surrogate.
|
static boolean |
isMirrored(char ch)
Determines whether the character is mirrored according to Unicode.
|
static boolean |
isMirrored(int codePoint)
Determines whether the character is mirrored according to Unicode.
|
static boolean |
isSpace(char ch)
Deprecated.
Replaced by
isWhitespace(char) |
static boolean |
isSpaceChar(char ch)
Determines if a character is a Unicode space character.
|
static boolean |
isSpaceChar(int codePoint)
Determines if a character is a Unicode space character.
|
static boolean |
isSupplementaryCodePoint(int codePoint)
Determines whether the specified code point is
in the range 0x10000 .. 0x10FFFF, i.e. the character is within the Unicode
supplementary character range.
|
static boolean |
isSurrogatePair(char ch1,
char ch2)
Return true if the given characters compose a surrogate pair.
|
static boolean |
isTitleCase(char ch)
Determines if a character is a Unicode titlecase letter.
|
static boolean |
isTitleCase(int codePoint)
Determines if a character is a Unicode titlecase letter.
|
static boolean |
isUnicodeIdentifierPart(char ch)
Determines if a character can follow the first letter in
a Unicode identifier.
|
static boolean |
isUnicodeIdentifierPart(int codePoint)
Determines if a character can follow the first letter in
a Unicode identifier.
|
static boolean |
isUnicodeIdentifierStart(char ch)
Determines if a character can start a Unicode identifier.
|
static boolean |
isUnicodeIdentifierStart(int codePoint)
Determines if a character can start a Unicode identifier.
|
static boolean |
isUpperCase(char ch)
Determines if a character is a Unicode uppercase letter.
|
static boolean |
isUpperCase(int codePoint)
Determines if a character is a Unicode uppercase letter.
|
static boolean |
isValidCodePoint(int codePoint)
Determines whether the specified code point is
in the range 0x0000 .. 0x10FFFF, i.e. it is a valid Unicode code point.
|
static boolean |
isWhitespace(char ch)
Determines if a character is Java whitespace.
|
static boolean |
isWhitespace(int codePoint)
Determines if a character is Java whitespace.
|
static int |
offsetByCodePoints(char[] a,
int start,
int count,
int index,
int codePointOffset)
Returns the index into the given char subarray that is offset
codePointOffset code points from index . |
static int |
offsetByCodePoints(CharSequence seq,
int index,
int codePointOffset)
Returns the index into the given CharSequence that is offset
codePointOffset code points from index . |
static char |
reverseBytes(char val)
Reverse the bytes in val.
|
static char[] |
toChars(int codePoint)
Converts a unicode code point to a UTF-16 representation of that
code point.
|
static int |
toChars(int codePoint,
char[] dst,
int dstIndex)
Converts a unicode code point to its UTF-16 representation.
|
static int |
toCodePoint(char high,
char low)
Given a valid surrogate pair, this returns the corresponding
code point.
|
static char |
toLowerCase(char ch)
Converts a Unicode character into its lowercase equivalent mapping.
|
static int |
toLowerCase(int codePoint)
Converts a Unicode character into its lowercase equivalent mapping.
|
String |
toString()
Converts the wrapped character into a String.
|
static String |
toString(char ch)
Returns a String of length 1 representing the specified character.
|
static char |
toTitleCase(char ch)
Converts a Unicode character into its titlecase equivalent mapping.
|
static int |
toTitleCase(int codePoint)
Converts a Unicode character into its titlecase equivalent mapping.
|
static char |
toUpperCase(char ch)
Converts a Unicode character into its uppercase equivalent mapping.
|
static int |
toUpperCase(int codePoint)
Converts a Unicode character into its uppercase equivalent mapping.
|
static Character |
valueOf(char val)
Returns an
Character object wrapping the value. |
public static final int MIN_RADIX
public static final int MAX_RADIX
public static final char MIN_VALUE
'\\u0000'
.public static final char MAX_VALUE
'\\uFFFF'
.public static final int MIN_CODE_POINT
0
.public static final int MAX_CODE_POINT
0x10FFFF
.public static final char MIN_HIGH_SURROGATE
'?'
.public static final char MAX_HIGH_SURROGATE
'?'
.public static final char MIN_LOW_SURROGATE
'?'
.public static final char MAX_LOW_SURROGATE
'?'
.public static final char MIN_SURROGATE
'?'
.public static final char MAX_SURROGATE
'?'
.public static final int MIN_SUPPLEMENTARY_CODE_POINT
0x10000
.public static final Class<Character> TYPE
public static final int SIZE
char
.public static final byte UPPERCASE_LETTER
public static final byte LOWERCASE_LETTER
public static final byte TITLECASE_LETTER
public static final byte NON_SPACING_MARK
public static final byte COMBINING_SPACING_MARK
public static final byte ENCLOSING_MARK
public static final byte DECIMAL_DIGIT_NUMBER
public static final byte LETTER_NUMBER
public static final byte OTHER_NUMBER
public static final byte SPACE_SEPARATOR
public static final byte LINE_SEPARATOR
public static final byte PARAGRAPH_SEPARATOR
public static final byte CONTROL
public static final byte FORMAT
public static final byte SURROGATE
public static final byte PRIVATE_USE
public static final byte UNASSIGNED
public static final byte MODIFIER_LETTER
public static final byte OTHER_LETTER
public static final byte CONNECTOR_PUNCTUATION
public static final byte DASH_PUNCTUATION
public static final byte START_PUNCTUATION
public static final byte END_PUNCTUATION
public static final byte INITIAL_QUOTE_PUNCTUATION
public static final byte FINAL_QUOTE_PUNCTUATION
public static final byte OTHER_PUNCTUATION
public static final byte MATH_SYMBOL
public static final byte CURRENCY_SYMBOL
public static final byte MODIFIER_SYMBOL
public static final byte OTHER_SYMBOL
public static final byte DIRECTIONALITY_UNDEFINED
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
public static final byte DIRECTIONALITY_ARABIC_NUMBER
public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
public static final byte DIRECTIONALITY_NONSPACING_MARK
public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL
public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR
public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR
public static final byte DIRECTIONALITY_WHITESPACE
public static final byte DIRECTIONALITY_OTHER_NEUTRALS
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
public Character(char value)
value
- the character to wrappublic char charValue()
public int hashCode()
hashCode
in class Object
Object.equals(Object)
,
System.identityHashCode(Object)
public boolean equals(Object o)
equals
in class Object
o
- object to compareObject.hashCode()
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
public static String toString(char ch)
ch
- the character to convertpublic static boolean isLowerCase(char ch)
'a'
is lowercase.
ch
- character to testisUpperCase(char)
,
isTitleCase(char)
,
toLowerCase(char)
,
getType(char)
public static boolean isLowerCase(int codePoint)
'a'
is lowercase. Unlike isLowerCase(char), this method
supports supplementary Unicode code points.
codePoint
- character to testisUpperCase(int)
,
isTitleCase(int)
,
toLowerCase(int)
,
getType(int)
public static boolean isUpperCase(char ch)
'A'
is uppercase.
ch
- character to testisLowerCase(char)
,
isTitleCase(char)
,
toUpperCase(char)
,
getType(char)
public static boolean isUpperCase(int codePoint)
'A'
is uppercase. Unlike isUpperCase(char), this method
supports supplementary Unicode code points.
codePoint
- character to testisLowerCase(int)
,
isTitleCase(int)
,
toUpperCase(int)
,
getType(int)
public static boolean isTitleCase(char ch)
ch
- character to testisLowerCase(char)
,
isUpperCase(char)
,
toTitleCase(char)
,
getType(char)
public static boolean isTitleCase(int codePoint)
codePoint
- character to testisLowerCase(int)
,
isUpperCase(int)
,
toTitleCase(int)
,
getType(int)
public static boolean isDigit(char ch)
'0'
is a digit.
ch
- character to testdigit(char, int)
,
forDigit(int, int)
,
getType(char)
public static boolean isDigit(int codePoint)
'0'
is a digit. Unlike isDigit(char), this method
supports supplementary Unicode code points.
codePoint
- character to testdigit(int, int)
,
forDigit(int, int)
,
getType(int)
public static boolean isDefined(char ch)
ch
- character to testisDigit(char)
,
isLetter(char)
,
isLetterOrDigit(char)
,
isLowerCase(char)
,
isTitleCase(char)
,
isUpperCase(char)
public static boolean isDefined(int codePoint)
codePoint
- character to testisDigit(int)
,
isLetter(int)
,
isLetterOrDigit(int)
,
isLowerCase(int)
,
isTitleCase(int)
,
isUpperCase(int)
public static boolean isLetter(char ch)
ch
- character to testisDigit(char)
,
isJavaIdentifierStart(char)
,
isJavaLetter(char)
,
isJavaLetterOrDigit(char)
,
isLetterOrDigit(char)
,
isLowerCase(char)
,
isTitleCase(char)
,
isUnicodeIdentifierStart(char)
,
isUpperCase(char)
public static boolean isLetter(int codePoint)
codePoint
- character to testisDigit(int)
,
isJavaIdentifierStart(int)
,
#isJavaLetter(int)
,
#isJavaLetterOrDigit(int)
,
isLetterOrDigit(int)
,
isLowerCase(int)
,
isTitleCase(int)
,
isUnicodeIdentifierStart(int)
,
isUpperCase(int)
public static int offsetByCodePoints(CharSequence seq, int index, int codePointOffset)
codePointOffset
code points from index
.seq
- the CharSequenceindex
- the start position in the CharSequencecodePointOffset
- the number of code points offset from the start
positionNullPointerException
- if seq is nullIndexOutOfBoundsException
- if index is negative or greater than the
length of the sequence.IndexOutOfBoundsException
- if codePointOffset is positive and the
subsequence from index to the end of seq has fewer than codePointOffset
code pointsIndexOutOfBoundsException
- if codePointOffset is negative and the
subsequence from the start of seq to index has fewer than
(-codePointOffset) code pointspublic static int offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset)
codePointOffset
code points from index
.a
- the char arraystart
- the start index of the subarraycount
- the length of the subarrayindex
- the index to be offsetcodePointOffset
- the number of code points offset from index
NullPointerException
- if a is nullIndexOutOfBoundsException
- if start or count is negative or if
start + count is greater than the length of the arrayIndexOutOfBoundsException
- if index is less than start or larger
than start + countIndexOutOfBoundsException
- if codePointOffset is positive and the
subarray from index to start + count - 1 has fewer than codePointOffset
code points.IndexOutOfBoundsException
- if codePointOffset is negative and the
subarray from start to index - 1 has fewer than (-codePointOffset) code
pointspublic static int codePointCount(CharSequence seq, int beginIndex, int endIndex)
seq
- the CharSequence to inspectbeginIndex
- the beginning of the rangeendIndex
- the end of the rangeNullPointerException
- if seq is nullIndexOutOfBoundsException
- if beginIndex is negative, endIndex is
larger than the length of seq, or if beginIndex is greater than endIndex.public static int codePointCount(char[] a, int offset, int count)
a
- the char array to inspectoffset
- the beginning of the rangecount
- the length of the rangeNullPointerException
- if a is nullIndexOutOfBoundsException
- if offset or count is negative or if
offset + countendIndex is larger than the length of a.public static boolean isLetterOrDigit(char ch)
ch
- character to testisDigit(char)
,
isJavaIdentifierPart(char)
,
isJavaLetter(char)
,
isJavaLetterOrDigit(char)
,
isLetter(char)
,
isUnicodeIdentifierPart(char)
public static boolean isLetterOrDigit(int codePoint)
codePoint
- character to testisDigit(int)
,
isJavaIdentifierPart(int)
,
#isJavaLetter(int)
,
#isJavaLetterOrDigit(int)
,
isLetter(int)
,
isUnicodeIdentifierPart(int)
public static boolean isJavaLetter(char ch)
isJavaIdentifierStart(char)
ch
- character to testisJavaLetterOrDigit(char)
,
isJavaIdentifierStart(char)
,
isJavaIdentifierPart(char)
,
isLetter(char)
,
isLetterOrDigit(char)
,
isUnicodeIdentifierStart(char)
public static boolean isJavaIdentifierStart(int codePoint)
codePoint
- character to testisJavaIdentifierPart(int)
,
isLetter(int)
,
isUnicodeIdentifierStart(int)
public static boolean isJavaLetterOrDigit(char ch)
isJavaIdentifierPart(char)
ch
- character to testisJavaLetter(char)
,
isJavaIdentifierStart(char)
,
isJavaIdentifierPart(char)
,
isLetter(char)
,
isLetterOrDigit(char)
,
isUnicodeIdentifierPart(char)
,
isIdentifierIgnorable(char)
public static boolean isJavaIdentifierStart(char ch)
ch
- character to testisJavaIdentifierPart(char)
,
isLetter(char)
,
isUnicodeIdentifierStart(char)
public static boolean isJavaIdentifierPart(char ch)
ch
- character to testisIdentifierIgnorable(char)
,
isJavaIdentifierStart(char)
,
isLetterOrDigit(char)
,
isUnicodeIdentifierPart(char)
public static boolean isJavaIdentifierPart(int codePoint)
codePoint
- character to testisIdentifierIgnorable(int)
,
isJavaIdentifierStart(int)
,
isLetterOrDigit(int)
,
isUnicodeIdentifierPart(int)
public static boolean isUnicodeIdentifierStart(char ch)
ch
- character to testisJavaIdentifierStart(char)
,
isLetter(char)
,
isUnicodeIdentifierPart(char)
public static boolean isUnicodeIdentifierStart(int codePoint)
codePoint
- character to testisJavaIdentifierStart(int)
,
isLetter(int)
,
isUnicodeIdentifierPart(int)
public static boolean isUnicodeIdentifierPart(char ch)
ch
- character to testisIdentifierIgnorable(char)
,
isJavaIdentifierPart(char)
,
isLetterOrDigit(char)
,
isUnicodeIdentifierStart(char)
public static boolean isUnicodeIdentifierPart(int codePoint)
codePoint
- character to testisIdentifierIgnorable(int)
,
isJavaIdentifierPart(int)
,
isLetterOrDigit(int)
,
isUnicodeIdentifierStart(int)
public static boolean isIdentifierIgnorable(char ch)
' '
through ''
, ''
through
''
, and ''
through
''
), and FORMAT characters.
ch
- character to testisJavaIdentifierPart(char)
,
isUnicodeIdentifierPart(char)
public static boolean isIdentifierIgnorable(int codePoint)
' '
through ''
, ''
through
''
, and ''
through
''
), and FORMAT characters. Unlike
isIdentifierIgnorable(char), this method supports supplementary Unicode
code points.
codePoint
- character to testisJavaIdentifierPart(int)
,
isUnicodeIdentifierPart(int)
public static char toLowerCase(char ch)
ch
- character to convert to lowercaseisLowerCase(char)
,
isUpperCase(char)
,
toTitleCase(char)
,
toUpperCase(char)
public static int toLowerCase(int codePoint)
codePoint
- character to convert to lowercaseisLowerCase(int)
,
isUpperCase(int)
,
toTitleCase(int)
,
toUpperCase(int)
public static char toUpperCase(char ch)
ch
- character to convert to uppercaseisLowerCase(char)
,
isUpperCase(char)
,
toLowerCase(char)
,
toTitleCase(char)
public static int toUpperCase(int codePoint)
codePoint
- character to convert to uppercaseisLowerCase(int)
,
isUpperCase(int)
,
toLowerCase(int)
,
toTitleCase(int)
public static char toTitleCase(char ch)
ch
- character to convert to titlecaseisTitleCase(char)
,
toLowerCase(char)
,
toUpperCase(char)
public static int toTitleCase(int codePoint)
codePoint
- character to convert to titlecaseisTitleCase(int)
,
toLowerCase(int)
,
toUpperCase(int)
public static int digit(char ch, int radix)
ch
- character to convert into a digitradix
- radix in which ch is a digitMIN_RADIX
,
MAX_RADIX
,
forDigit(int, int)
,
isDigit(char)
,
getNumericValue(char)
public static int digit(int codePoint, int radix)
codePoint
- character to convert into a digitradix
- radix in which codePoint is a digitMIN_RADIX
,
MAX_RADIX
,
forDigit(int, int)
,
isDigit(int)
,
getNumericValue(int)
public static int getNumericValue(char ch)
'\\u216C'
(the Roman numeral fifty) returns 50.
This method also returns values for the letters A through Z, (not
specified by Unicode), in these ranges: 'A'
through 'Z'
(uppercase); 'a'
through 'z'
(lowercase); and 'A'
through 'Z'
, 'a'
through
'z'
(full width variants).
If the character lacks a numeric value property, -1 is returned. If the character has a numeric value property which is not representable as a nonnegative integer, such as a fraction, -2 is returned. character argument boundary = [Nd]|[Nl]|[No]|U+0041-U+005A|U+0061-U+007A |U+FF21-U+FF3A|U+FF41-U+FF5A
ch
- character from which the numeric value property will
be retrievedforDigit(int, int)
,
digit(char, int)
,
isDigit(char)
public static int getNumericValue(int codePoint)
'\\u216C'
(the Roman numeral fifty) returns 50.
This method also returns values for the letters A through Z, (not
specified by Unicode), in these ranges: 'A'
through 'Z'
(uppercase); 'a'
through 'z'
(lowercase); and 'A'
through 'Z'
, 'a'
through
'z'
(full width variants).
If the character lacks a numeric value property, -1 is returned. If the character has a numeric value property which is not representable as a nonnegative integer, such as a fraction, -2 is returned. Unlike getNumericValue(char), this method supports supplementary Unicode code points. character argument boundary = [Nd]|[Nl]|[No]|U+0041-U+005A|U+0061-U+007A |U+FF21-U+FF3A|U+FF41-U+FF5A
codePoint
- character from which the numeric value property will
be retrievedforDigit(int, int)
,
digit(int, int)
,
isDigit(int)
public static boolean isSpace(char ch)
isWhitespace(char)
'\t'
, '\n'
, '\f'
,
'\r'
, and ' '
.
ch
- character to testisSpaceChar(char)
,
isWhitespace(char)
public static boolean isSpaceChar(char ch)
ch
- character to testisWhitespace(char)
public static boolean isSpaceChar(int codePoint)
codePoint
- character to testisWhitespace(int)
public static boolean isWhitespace(char ch)
' '
, ' '
, and ' '
);
and these characters: ' '
, '
'
,
''
, ' '
, '
'
,
''
, ''
, ''
,
and ''
.
ch
- character to testisSpaceChar(char)
public static boolean isWhitespace(int codePoint)
' '
, ' '
, and ' '
);
and these characters: ' '
, '
'
,
''
, ' '
, '
'
,
''
, ''
, ''
,
and ''
. Unlike isWhitespace(char), this method
supports supplementary Unicode code points.
codePoint
- character to testisSpaceChar(int)
public static boolean isISOControl(char ch)
ch
- character to testisSpaceChar(char)
,
isWhitespace(char)
public static boolean isISOControl(int codePoint)
codePoint
- character to testisSpaceChar(int)
,
isWhitespace(int)
public static int getType(char ch)
ch
- character from which the general category property will
be retrievedUNASSIGNED
,
UPPERCASE_LETTER
,
LOWERCASE_LETTER
,
TITLECASE_LETTER
,
MODIFIER_LETTER
,
OTHER_LETTER
,
NON_SPACING_MARK
,
ENCLOSING_MARK
,
COMBINING_SPACING_MARK
,
DECIMAL_DIGIT_NUMBER
,
LETTER_NUMBER
,
OTHER_NUMBER
,
SPACE_SEPARATOR
,
LINE_SEPARATOR
,
PARAGRAPH_SEPARATOR
,
CONTROL
,
FORMAT
,
PRIVATE_USE
,
SURROGATE
,
DASH_PUNCTUATION
,
START_PUNCTUATION
,
END_PUNCTUATION
,
CONNECTOR_PUNCTUATION
,
OTHER_PUNCTUATION
,
MATH_SYMBOL
,
CURRENCY_SYMBOL
,
MODIFIER_SYMBOL
,
INITIAL_QUOTE_PUNCTUATION
,
FINAL_QUOTE_PUNCTUATION
public static int getType(int codePoint)
codePoint
- character from which the general category property will
be retrievedUNASSIGNED
,
UPPERCASE_LETTER
,
LOWERCASE_LETTER
,
TITLECASE_LETTER
,
MODIFIER_LETTER
,
OTHER_LETTER
,
NON_SPACING_MARK
,
ENCLOSING_MARK
,
COMBINING_SPACING_MARK
,
DECIMAL_DIGIT_NUMBER
,
LETTER_NUMBER
,
OTHER_NUMBER
,
SPACE_SEPARATOR
,
LINE_SEPARATOR
,
PARAGRAPH_SEPARATOR
,
CONTROL
,
FORMAT
,
PRIVATE_USE
,
SURROGATE
,
DASH_PUNCTUATION
,
START_PUNCTUATION
,
END_PUNCTUATION
,
CONNECTOR_PUNCTUATION
,
OTHER_PUNCTUATION
,
MATH_SYMBOL
,
CURRENCY_SYMBOL
,
MODIFIER_SYMBOL
,
INITIAL_QUOTE_PUNCTUATION
,
FINAL_QUOTE_PUNCTUATION
public static char forDigit(int digit, int radix)
'\0'
is returned. Otherwise the return value is in '0'-'9' and 'a'-'z'.
digit
- digit to be converted into a characterradix
- radix of digitMIN_RADIX
,
MAX_RADIX
,
digit(char, int)
public static byte getDirectionality(char ch)
ch
- the character to look upDIRECTIONALITY_UNDEFINED
,
DIRECTIONALITY_LEFT_TO_RIGHT
,
DIRECTIONALITY_RIGHT_TO_LEFT
,
DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
,
DIRECTIONALITY_EUROPEAN_NUMBER
,
DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
,
DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
,
DIRECTIONALITY_ARABIC_NUMBER
,
DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
,
DIRECTIONALITY_NONSPACING_MARK
,
DIRECTIONALITY_BOUNDARY_NEUTRAL
,
DIRECTIONALITY_PARAGRAPH_SEPARATOR
,
DIRECTIONALITY_SEGMENT_SEPARATOR
,
DIRECTIONALITY_WHITESPACE
,
DIRECTIONALITY_OTHER_NEUTRALS
,
DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
,
DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
,
DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
,
DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
,
DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
public static byte getDirectionality(int codePoint)
codePoint
- the character to look upDIRECTIONALITY_UNDEFINED
,
DIRECTIONALITY_LEFT_TO_RIGHT
,
DIRECTIONALITY_RIGHT_TO_LEFT
,
DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
,
DIRECTIONALITY_EUROPEAN_NUMBER
,
DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
,
DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
,
DIRECTIONALITY_ARABIC_NUMBER
,
DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
,
DIRECTIONALITY_NONSPACING_MARK
,
DIRECTIONALITY_BOUNDARY_NEUTRAL
,
DIRECTIONALITY_PARAGRAPH_SEPARATOR
,
DIRECTIONALITY_SEGMENT_SEPARATOR
,
DIRECTIONALITY_WHITESPACE
,
DIRECTIONALITY_OTHER_NEUTRALS
,
DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
,
DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
,
DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
,
DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
,
DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
public static boolean isMirrored(char ch)
(
(LEFT PARENTHESIS) appears as '(' in
left-to-right text, but ')' in right-to-left text.ch
- the character to look uppublic static boolean isMirrored(int codePoint)
(
(LEFT PARENTHESIS) appears as '(' in
left-to-right text, but ')' in right-to-left text. Unlike
isMirrored(char), this method supports supplementary Unicode code points.codePoint
- the character to look uppublic int compareTo(Character anotherCharacter)
compareTo
in interface Comparable<Character>
anotherCharacter
- Character to compare with this CharacterNullPointerException
- if anotherCharacter is nullpublic static Character valueOf(char val)
Character
object wrapping the value.
In contrast to the Character
constructor, this method
will cache some values. It is used by boxing conversion.val
- the value to wrapCharacter
public static char reverseBytes(char val)
public static char[] toChars(int codePoint)
codePoint
- the unicode code pointIllegalArgumentException
- if the code point is not a valid
unicode code pointpublic static int toChars(int codePoint, char[] dst, int dstIndex)
codePoint
- the unicode code pointdst
- the target char arraydstIndex
- the start index for the targetdst
IllegalArgumentException
- if codePoint
is not a
valid unicode code pointNullPointerException
- if dst
is null
IndexOutOfBoundsException
- if dstIndex
is not valid
in dst
or if the UTF-16 representation does not
fit into dst
public static int charCount(int codePoint)
codePoint
- a unicode code pointpublic static boolean isSupplementaryCodePoint(int codePoint)
codePoint
- a Unicode code pointtrue
if code point is in supplementary rangepublic static boolean isValidCodePoint(int codePoint)
codePoint
- a Unicode code pointtrue
if code point is validpublic static boolean isHighSurrogate(char ch)
ch
- the characterpublic static boolean isLowSurrogate(char ch)
ch
- the characterpublic static boolean isSurrogatePair(char ch1, char ch2)
ch1
- the first characterch2
- the first characterpublic static int toCodePoint(char high, char low)
high
- the high character of the pairlow
- the low character of the pairpublic static int codePointAt(CharSequence sequence, int index)
sequence
- the CharSequenceindex
- the index of the codepoint to get, starting at 0IndexOutOfBoundsException
- if index is negative or >= length()public static int codePointAt(char[] chars, int index)
chars
- the character array in which to lookindex
- the index of the codepoint to get, starting at 0IndexOutOfBoundsException
- if index is negative or >= length()public static int codePointAt(char[] chars, int index, int limit)
chars
- the character array in which to lookindex
- the index of the codepoint to get, starting at 0limit
- the limit past which characters should not be examinedIndexOutOfBoundsException
- if index is negative or >=
limit, or if limit is negative or >= the length of the arraypublic static int codePointBefore(char[] chars, int index)
index-1
and index-2
to see if they form
a supplementary code point. If they do not, the character at
index-1
is returned.chars
- the character arrayindex
- the index just past the codepoint to get, starting at 0IndexOutOfBoundsException
- if index is negative or >= length()public static int codePointBefore(char[] chars, int index, int start)
index-1
and index-2
to see if they form
a supplementary code point. If they do not, the character at
index-1
is returned. The start parameter is used to
limit the range of the array which may be examined.chars
- the character arrayindex
- the index just past the codepoint to get, starting at 0start
- the index before which characters should not be examinedIndexOutOfBoundsException
- if index is > start or >
the length of the array, or if limit is negative or >= the
length of the arraypublic static int codePointBefore(CharSequence sequence, int index)
index-1
and index-2
to see if they form
a supplementary code point. If they do not, the character at
index-1
is returned.sequence
- the CharSequenceindex
- the index just past the codepoint to get, starting at 0IndexOutOfBoundsException
- if index is negative or >= length()