Build 1.0_r1(from source)

java.lang
Class Character

java.lang.Object
  extended by java.lang.Character
All Implemented Interfaces:
Serializable, Comparable<Character>

public final class Character
extends Object
implements Serializable, Comparable<Character>

Character is the wrapper for the primitive type char. This class also provides a number of utility methods for working with chars.

Character data is based upon the Unicode Standard, 4.0. The Unicode specification, character tables and other information are available at http://www.unicode.org/.

Unicode characters are referred to as code points. The range of valid code points is U+0000 to U+10FFFF. The Basic Multilingual Plane (BMP) is the code point range U+0000 to U+FFFF. Characters above the BMP are referred to as Supplementary Characters. On the Java platform, UTF-16 encoding and char pairs are used to represent code points in the supplementary range. A pair of char values that represent a supplementary character are made up of a high surrogate with a value range of 0xD800 to 0xDBFF and a low surrogate with a value range of 0xDC00 to 0xDFFF.

On the Java platform a char value represents either a single BMP code point or a UTF-16 unit that's part of a surrogate pair. The int type is used to represent all Unicode code points.

Since:
1.0
See Also:
Serialized Form

Nested Class Summary
static class Character.Subset
           
static class Character.UnicodeBlock
          Blocks of characters, as defined by the Unicode 4.0.1 specification.
(package private) static class Character.valueOfCache
           
 
Field Summary
static byte COMBINING_SPACING_MARK
          Unicode category constant Mc.
static byte CONNECTOR_PUNCTUATION
          Unicode category constant Pc.
static byte CONTROL
          Unicode category constant Cc.
static byte CURRENCY_SYMBOL
          Unicode category constant Sc.
static byte DASH_PUNCTUATION
          Unicode category constant Pd.
static byte DECIMAL_DIGIT_NUMBER
          Unicode category constant Nd.
static byte DIRECTIONALITY_ARABIC_NUMBER
          Unicode bidirectional constant AN.
static byte DIRECTIONALITY_BOUNDARY_NEUTRAL
          Unicode bidirectional constant BN.
static byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
          Unicode bidirectional constant CS.
static byte DIRECTIONALITY_EUROPEAN_NUMBER
          Unicode bidirectional constant EN.
static byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
          Unicode bidirectional constant ES.
static byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
          Unicode bidirectional constant ET.
static byte DIRECTIONALITY_LEFT_TO_RIGHT
          Unicode bidirectional constant L.
static byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
          Unicode bidirectional constant LRE.
static byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
          Unicode bidirectional constant LRO.
static byte DIRECTIONALITY_NONSPACING_MARK
          Unicode bidirectional constant NSM.
static byte DIRECTIONALITY_OTHER_NEUTRALS
          Unicode bidirectional constant ON.
static byte DIRECTIONALITY_PARAGRAPH_SEPARATOR
          Unicode bidirectional constant B.
static byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
          Unicode bidirectional constant PDF.
static byte DIRECTIONALITY_RIGHT_TO_LEFT
          Unicode bidirectional constant R.
static byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
          Unicode bidirectional constant AL.
static byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
          Unicode bidirectional constant RLE.
static byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
          Unicode bidirectional constant RLO.
static byte DIRECTIONALITY_SEGMENT_SEPARATOR
          Unicode bidirectional constant S.
static byte DIRECTIONALITY_UNDEFINED
          Unicode bidirectional constant.
static byte DIRECTIONALITY_WHITESPACE
          Unicode bidirectional constant WS.
static byte ENCLOSING_MARK
          Unicode category constant Me.
static byte END_PUNCTUATION
          Unicode category constant Pe.
static byte FINAL_QUOTE_PUNCTUATION
          Unicode category constant Pf.
static byte FORMAT
          Unicode category constant Cf.
static byte INITIAL_QUOTE_PUNCTUATION
          Unicode category constant Pi.
static byte LETTER_NUMBER
          Unicode category constant Nl.
static byte LINE_SEPARATOR
          Unicode category constant Zl.
static byte LOWERCASE_LETTER
          Unicode category constant Ll.
static byte MATH_SYMBOL
          Unicode category constant Sm.
static int MAX_CODE_POINT
           Maximum code point value - U+10FFFF.
static char MAX_HIGH_SURROGATE
           Maximum value of a high surrogate or leading surrogate unit in UTF-16 encoding - '?'.
static char MAX_LOW_SURROGATE
          Maximum value of a low surrogate or trailing surrogate unit in UTF-16 encoding - '?'.
static int MAX_RADIX
          The maximum possible radix used for conversions between Characters and integers.
static char MAX_SURROGATE
           Maximum value of a surrogate unit in UTF-16 encoding - '?'.
static char MAX_VALUE
          The maximum possible Character value.
static int MIN_CODE_POINT
           Minimum code point value - U+0000.
static char MIN_HIGH_SURROGATE
           Minimum value of a high surrogate or leading surrogate unit in UTF-16 encoding - '?'.
static char MIN_LOW_SURROGATE
           Minimum value of a low surrogate or trailing surrogate unit in UTF-16 encoding - '?'.
static int MIN_RADIX
          The minimum possible radix used for conversions between Characters and integers.
static int MIN_SUPPLEMENTARY_CODE_POINT
           Minimum value of a supplementary code point - U+010000.
static char MIN_SURROGATE
           Minimum value of a surrogate unit in UTF-16 encoding - '?'.
static char MIN_VALUE
          The minimum possible Character value.
static byte MODIFIER_LETTER
          Unicode category constant Lm.
static byte MODIFIER_SYMBOL
          Unicode category constant Sk.
static byte NON_SPACING_MARK
          Unicode category constant Mn.
static byte OTHER_LETTER
          Unicode category constant Lo.
static byte OTHER_NUMBER
          Unicode category constant No.
static byte OTHER_PUNCTUATION
          Unicode category constant Po.
static byte OTHER_SYMBOL
          Unicode category constant So.
static byte PARAGRAPH_SEPARATOR
          Unicode category constant Zp.
static byte PRIVATE_USE
          Unicode category constant Co.
static int SIZE
           Constant for the number of bits to represent a char in two's compliment form.
static byte SPACE_SEPARATOR
          Unicode category constant Zs.
static byte START_PUNCTUATION
          Unicode category constant Ps.
static byte SURROGATE
          Unicode category constant Cs.
static byte TITLECASE_LETTER
          Unicode category constant Lt.
static Class<Character> TYPE
          The char Class object.
static byte UNASSIGNED
          Unicode category constant Cn.
static byte UPPERCASE_LETTER
          Unicode category constant Lu.
 
Constructor Summary
Character(char value)
          Constructs a new instance of the receiver which represents the char valued argument.
 
Method Summary
static int charCount(int codePoint)
           Calculates the number of char values required to represent the Unicode code point.
 char charValue()
          Returns the char value which the receiver represents.
static int codePointAt(char[] seq, int index)
           Returns the code point at the index in the char[].
static int codePointAt(char[] seq, int index, int limit)
           Returns the code point at the index in the char[] that's within the limit.
static int codePointAt(CharSequence seq, int index)
           Returns the code point at the index in the CharSequence.
static int codePointBefore(char[] seq, int index)
           Returns the Unicode code point that proceeds the index in the char[].
static int codePointBefore(char[] seq, int index, int start)
           Returns the Unicode code point that proceeds the index in the char[] and isn't less than start.
static int codePointBefore(CharSequence seq, int index)
           Returns the Unicode code point that proceeds the index in the CharSequence.
static int codePointCount(char[] seq, int offset, int count)
           Counts the number of Unicode code points in the subsequence of the char[], as delineated by the offset and count.
static int codePointCount(CharSequence seq, int beginIndex, int endIndex)
           Counts the number of Unicode code points in the subsequence of the CharSequence, as delineated by the beginIndex and endIndex.
 int compareTo(Character c)
          Compares the receiver to the specified Character to determine the relative ordering.
static int digit(char c, int radix)
          Convenient method to determine the value of character c in the supplied radix.
static int digit(int codePoint, int radix)
          Convenient method to determine the value of character codePoint in the supplied radix.
 boolean equals(Object object)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
static char forDigit(int digit, int radix)
          Returns the character which represents the value in the specified radix.
static byte getDirectionality(char c)
          Gets the Unicode directionality of the specified character.
static byte getDirectionality(int codePoint)
          Gets the Unicode directionality of the specified character.
static int getNumericValue(char c)
          Gets the numeric value of the Unicode character.
static int getNumericValue(int codePoint)
          Gets the numeric value of the Unicode character.
static int getType(char c)
          Gets the general Unicode category of the specified character.
static int getType(int codePoint)
          Gets the general Unicode category of the specified character.
 int hashCode()
          Returns an integer hash code for the receiver.
static boolean isDefined(char c)
          Returns whether the specified character is defined in the Unicode specification.
static boolean isDefined(int codePoint)
          Returns whether the specified character is defined in the Unicode specification.
static boolean isDigit(char c)
          Returns whether the character is a digit.
static boolean isDigit(int codePoint)
          Returns whether the character is a digit.
static boolean isHighSurrogate(char ch)
           A test for determining if the char is a high surrogate/leading surrogate unit that's used for representing supplementary characters in UTF-16 encoding.
static boolean isIdentifierIgnorable(char c)
          Returns whether the specified character is ignorable in a Java or Unicode identifier.
static boolean isIdentifierIgnorable(int codePoint)
          Returns whether the specified character is ignorable in a Java or Unicode identifier.
static boolean isISOControl(char c)
          Returns whether the character is an ISO control character.
static boolean isISOControl(int c)
          Returns whether the character is an ISO control character.
static boolean isJavaIdentifierPart(char c)
          Returns whether the character is a valid part of a Unicode identifier as other than the first character.
static boolean isJavaIdentifierPart(int codePoint)
          Returns whether the character is a valid part of a Unicode identifier as other than the first character.
static boolean isJavaIdentifierStart(char c)
          Returns whether the character is a valid start of a Unicode identifier
static boolean isJavaIdentifierStart(int codePoint)
          Returns whether the character is a valid start of a Unicode identifier
static boolean isJavaLetter(char c)
          Deprecated. Use isJavaIdentifierStart(char)
static boolean isJavaLetterOrDigit(char c)
          Deprecated. Use isJavaIdentifierPart(char)
static boolean isLetter(char c)
          Returns whether the character is a letter.
static boolean isLetter(int codePoint)
          Returns whether the character is a letter.
static boolean isLetterOrDigit(char c)
          Returns whether the character is a letter or a digit.
static boolean isLetterOrDigit(int codePoint)
          Returns whether the character is a letter or a digit.
static boolean isLowerCase(char c)
          Returns whether the character is a lower case letter.
static boolean isLowerCase(int codePoint)
          Returns whether the character is a lower case letter.
static boolean isLowSurrogate(char ch)
           A test for determining if the char is a high surrogate/leading surrogate unit that's used for representing supplementary characters in UTF-16 encoding.
static boolean isMirrored(char c)
          Returns whether the specified character is mirrored
static boolean isMirrored(int codePoint)
          Returns whether the specified character is mirrored
static boolean isSpace(char c)
          Deprecated. Use isWhitespace(char)
static boolean isSpaceChar(char c)
          Returns whether the character is a Unicode space character.
static boolean isSpaceChar(int codePoint)
          Returns whether the character is a Unicode space character.
static boolean isSupplementaryCodePoint(int codePoint)
           A test for determining if the codePoint is within the supplementary code point range.
static boolean isSurrogatePair(char high, char low)
           A test for determining if the char pair is a valid surrogate pair.
static boolean isTitleCase(char c)
          Returns whether the character is a titlecase character.
static boolean isTitleCase(int codePoint)
          Returns whether the character is a titlecase character.
static boolean isUnicodeIdentifierPart(char c)
          Returns whether the character is valid as part of a Unicode identifier as other than the first character.
static boolean isUnicodeIdentifierPart(int codePoint)
          Returns whether the character is valid as part of a Unicode identifier as other than the first character.
static boolean isUnicodeIdentifierStart(char c)
          Returns whether the character is a valid initial character for a Unicode identifier.
static boolean isUnicodeIdentifierStart(int codePoint)
          Returns whether the character is a valid initial character for a Unicode identifier.
static boolean isUpperCase(char c)
          Returns whether the character is an upper case letter.
static boolean isUpperCase(int codePoint)
          Returns whether the character is an upper case letter.
static boolean isValidCodePoint(int codePoint)
           A test for determining if the codePoint is a valid Unicode code point.
static boolean isWhitespace(char c)
          Returns whether the character is a whitespace character in Java.
static boolean isWhitespace(int codePoint)
          Returns whether the character is a whitespace character in Java.
static int offsetByCodePoints(char[] seq, int start, int count, int index, int codePointOffset)
           Determines the index into the char[] that is offset (measured in code points and specified by codePointOffset), from the index argument and is within the subsequence as delineated by start and count.
static int offsetByCodePoints(CharSequence seq, int index, int codePointOffset)
           Determines the index into the CharSequence that is offset (measured in code points and specified by codePointOffset), from the index argument.
static char reverseBytes(char c)
          Reverse the order of the first and second bytes in character
static char[] toChars(int codePoint)
           Converts the Unicode code point, codePoint, into a UTF-16 encoded sequence that is returned as a char[].
static int toChars(int codePoint, char[] dst, int dstIndex)
           Converts the Unicode code point, codePoint, into a UTF-16 encoded sequence and copies the value(s) into the char[] dst, starting at the index dstIndex.
static int toCodePoint(char high, char low)
           Converts a surrogate pair into a Unicode code point.
static char toLowerCase(char c)
          Returns the lower case equivalent for the character when the character is an upper case letter, otherwise returns the character.
static int toLowerCase(int codePoint)
          Returns the lower case equivalent for the character when the character is an upper case letter, otherwise returns the character.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
static String toString(char value)
          Converts the specified character to its string representation.
static char toTitleCase(char c)
          Returns the title case equivalent for the character, otherwise returns the character.
static int toTitleCase(int codePoint)
          Returns the title case equivalent for the character, otherwise returns the character.
static char toUpperCase(char c)
          Returns the upper case equivalent for the character when the character is a lower case letter, otherwise returns the character.
static int toUpperCase(int codePoint)
          Returns the upper case equivalent for the character when the character is a lower case letter, otherwise returns the character.
static Character valueOf(char c)
           Returns a Character instance for the char value passed.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN_VALUE

public static final char MIN_VALUE
The minimum possible Character value.

See Also:
Constant Field Values

MAX_VALUE

public static final char MAX_VALUE
The maximum possible Character value.

See Also:
Constant Field Values

MIN_RADIX

public static final int MIN_RADIX
The minimum possible radix used for conversions between Characters and integers.

See Also:
Constant Field Values

MAX_RADIX

public static final int MAX_RADIX
The maximum possible radix used for conversions between Characters and integers.

See Also:
Constant Field Values

TYPE

public static final Class<Character> TYPE
The char Class object.


UNASSIGNED

public static final byte UNASSIGNED
Unicode category constant Cn.

See Also:
Constant Field Values

UPPERCASE_LETTER

public static final byte UPPERCASE_LETTER
Unicode category constant Lu.

See Also:
Constant Field Values

LOWERCASE_LETTER

public static final byte LOWERCASE_LETTER
Unicode category constant Ll.

See Also:
Constant Field Values

TITLECASE_LETTER

public static final byte TITLECASE_LETTER
Unicode category constant Lt.

See Also:
Constant Field Values

MODIFIER_LETTER

public static final byte MODIFIER_LETTER
Unicode category constant Lm.

See Also:
Constant Field Values

OTHER_LETTER

public static final byte OTHER_LETTER
Unicode category constant Lo.

See Also:
Constant Field Values

NON_SPACING_MARK

public static final byte NON_SPACING_MARK
Unicode category constant Mn.

See Also:
Constant Field Values

ENCLOSING_MARK

public static final byte ENCLOSING_MARK
Unicode category constant Me.

See Also:
Constant Field Values

COMBINING_SPACING_MARK

public static final byte COMBINING_SPACING_MARK
Unicode category constant Mc.

See Also:
Constant Field Values

DECIMAL_DIGIT_NUMBER

public static final byte DECIMAL_DIGIT_NUMBER
Unicode category constant Nd.

See Also:
Constant Field Values

LETTER_NUMBER

public static final byte LETTER_NUMBER
Unicode category constant Nl.

See Also:
Constant Field Values

OTHER_NUMBER

public static final byte OTHER_NUMBER
Unicode category constant No.

See Also:
Constant Field Values

SPACE_SEPARATOR

public static final byte SPACE_SEPARATOR
Unicode category constant Zs.

See Also:
Constant Field Values

LINE_SEPARATOR

public static final byte LINE_SEPARATOR
Unicode category constant Zl.

See Also:
Constant Field Values

PARAGRAPH_SEPARATOR

public static final byte PARAGRAPH_SEPARATOR
Unicode category constant Zp.

See Also:
Constant Field Values

CONTROL

public static final byte CONTROL
Unicode category constant Cc.

See Also:
Constant Field Values

FORMAT

public static final byte FORMAT
Unicode category constant Cf.

See Also:
Constant Field Values

PRIVATE_USE

public static final byte PRIVATE_USE
Unicode category constant Co.

See Also:
Constant Field Values

SURROGATE

public static final byte SURROGATE
Unicode category constant Cs.

See Also:
Constant Field Values

DASH_PUNCTUATION

public static final byte DASH_PUNCTUATION
Unicode category constant Pd.

See Also:
Constant Field Values

START_PUNCTUATION

public static final byte START_PUNCTUATION
Unicode category constant Ps.

See Also:
Constant Field Values

END_PUNCTUATION

public static final byte END_PUNCTUATION
Unicode category constant Pe.

See Also:
Constant Field Values

CONNECTOR_PUNCTUATION

public static final byte CONNECTOR_PUNCTUATION
Unicode category constant Pc.

See Also:
Constant Field Values

OTHER_PUNCTUATION

public static final byte OTHER_PUNCTUATION
Unicode category constant Po.

See Also:
Constant Field Values

MATH_SYMBOL

public static final byte MATH_SYMBOL
Unicode category constant Sm.

See Also:
Constant Field Values

CURRENCY_SYMBOL

public static final byte CURRENCY_SYMBOL
Unicode category constant Sc.

See Also:
Constant Field Values

MODIFIER_SYMBOL

public static final byte MODIFIER_SYMBOL
Unicode category constant Sk.

See Also:
Constant Field Values

OTHER_SYMBOL

public static final byte OTHER_SYMBOL
Unicode category constant So.

See Also:
Constant Field Values

INITIAL_QUOTE_PUNCTUATION

public static final byte INITIAL_QUOTE_PUNCTUATION
Unicode category constant Pi.

Since:
1.4
See Also:
Constant Field Values

FINAL_QUOTE_PUNCTUATION

public static final byte FINAL_QUOTE_PUNCTUATION
Unicode category constant Pf.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_UNDEFINED

public static final byte DIRECTIONALITY_UNDEFINED
Unicode bidirectional constant.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_LEFT_TO_RIGHT

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT
Unicode bidirectional constant L.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_RIGHT_TO_LEFT

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT
Unicode bidirectional constant R.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
Unicode bidirectional constant AL.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_EUROPEAN_NUMBER

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER
Unicode bidirectional constant EN.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
Unicode bidirectional constant ES.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
Unicode bidirectional constant ET.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_ARABIC_NUMBER

public static final byte DIRECTIONALITY_ARABIC_NUMBER
Unicode bidirectional constant AN.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_COMMON_NUMBER_SEPARATOR

public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
Unicode bidirectional constant CS.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_NONSPACING_MARK

public static final byte DIRECTIONALITY_NONSPACING_MARK
Unicode bidirectional constant NSM.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_BOUNDARY_NEUTRAL

public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL
Unicode bidirectional constant BN.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_PARAGRAPH_SEPARATOR

public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR
Unicode bidirectional constant B.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_SEGMENT_SEPARATOR

public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR
Unicode bidirectional constant S.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_WHITESPACE

public static final byte DIRECTIONALITY_WHITESPACE
Unicode bidirectional constant WS.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_OTHER_NEUTRALS

public static final byte DIRECTIONALITY_OTHER_NEUTRALS
Unicode bidirectional constant ON.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
Unicode bidirectional constant LRE.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
Unicode bidirectional constant LRO.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
Unicode bidirectional constant RLE.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
Unicode bidirectional constant RLO.

Since:
1.4
See Also:
Constant Field Values

DIRECTIONALITY_POP_DIRECTIONAL_FORMAT

public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
Unicode bidirectional constant PDF.

Since:
1.4
See Also:
Constant Field Values

MIN_HIGH_SURROGATE

public static final char MIN_HIGH_SURROGATE

Minimum value of a high surrogate or leading surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MAX_HIGH_SURROGATE

public static final char MAX_HIGH_SURROGATE

Maximum value of a high surrogate or leading surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MIN_LOW_SURROGATE

public static final char MIN_LOW_SURROGATE

Minimum value of a low surrogate or trailing surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MAX_LOW_SURROGATE

public static final char MAX_LOW_SURROGATE
Maximum value of a low surrogate or trailing surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MIN_SURROGATE

public static final char MIN_SURROGATE

Minimum value of a surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MAX_SURROGATE

public static final char MAX_SURROGATE

Maximum value of a surrogate unit in UTF-16 encoding - '?'.

Since:
1.5
See Also:
Constant Field Values

MIN_SUPPLEMENTARY_CODE_POINT

public static final int MIN_SUPPLEMENTARY_CODE_POINT

Minimum value of a supplementary code point - U+010000.

Since:
1.5
See Also:
Constant Field Values

MIN_CODE_POINT

public static final int MIN_CODE_POINT

Minimum code point value - U+0000.

Since:
1.5
See Also:
Constant Field Values

MAX_CODE_POINT

public static final int MAX_CODE_POINT

Maximum code point value - U+10FFFF.

Since:
1.5
See Also:
Constant Field Values

SIZE

public static final int SIZE

Constant for the number of bits to represent a char in two's compliment form.

Since:
1.5
See Also:
Constant Field Values
Constructor Detail

Character

public Character(char value)
Constructs a new instance of the receiver which represents the char valued argument.

Parameters:
value - the char to store in the new instance.
Method Detail

charValue

public char charValue()
Returns the char value which the receiver represents.

Returns:
char the value of the receiver

compareTo

public int compareTo(Character c)
Compares the receiver to the specified Character to determine the relative ordering.

Specified by:
compareTo in interface Comparable<Character>
Parameters:
c - the Character
Returns:
an int < 0="" if="" this="" character="" is="" less="" than="" the="" specified="" character,="" 0="" if="" they="" are="" equal,="" and=""> 0 if this Character is greater
Throws:
NullPointerException - if c is null.
Since:
1.2

valueOf

public static Character valueOf(char c)

Returns a Character instance for the char value passed. This method is preferred over the constructor, as this method may maintain a cache of instances.

Parameters:
c - The char value.
Returns:
A Character instance.
Since:
1.5

isValidCodePoint

public static boolean isValidCodePoint(int codePoint)

A test for determining if the codePoint is a valid Unicode code point.

Parameters:
codePoint - The code point to test.
Returns:
A boolean value.
Since:
1.5

isSupplementaryCodePoint

public static boolean isSupplementaryCodePoint(int codePoint)

A test for determining if the codePoint is within the supplementary code point range.

Parameters:
codePoint - The code point to test.
Returns:
A boolean value.
Since:
1.5

isHighSurrogate

public static boolean isHighSurrogate(char ch)

A test for determining if the char is a high surrogate/leading surrogate unit that's used for representing supplementary characters in UTF-16 encoding.

Parameters:
ch - The char unit to test.
Returns:
A boolean value.
Since:
1.5
See Also:
isLowSurrogate(char)

isLowSurrogate

public static boolean isLowSurrogate(char ch)

A test for determining if the char is a high surrogate/leading surrogate unit that's used for representing supplementary characters in UTF-16 encoding.

Parameters:
ch - The char unit to test.
Returns:
A boolean value.
Since:
1.5
See Also:
isHighSurrogate(char)

isSurrogatePair

public static boolean isSurrogatePair(char high,
                                      char low)

A test for determining if the char pair is a valid surrogate pair.

Parameters:
high - The high surrogate unit to test.
low - The low surrogate unit to test.
Returns:
A boolean value.
Since:
1.5
See Also:
isHighSurrogate(char), isLowSurrogate(char)

charCount

public static int charCount(int codePoint)

Calculates the number of char values required to represent the Unicode code point. This method only tests if the codePoint is greater than or equal to 0x10000, in which case 2 is returned, otherwise 1. To test if the code point is valid, use the isValidCodePoint(int) method.

Parameters:
codePoint - The code point to test.
Returns:
An int value of 2 or 1.
Since:
1.5
See Also:
isValidCodePoint(int), isSupplementaryCodePoint(int)

toCodePoint

public static int toCodePoint(char high,
                              char low)

Converts a surrogate pair into a Unicode code point. This method assume that the pair are valid surrogates. If the pair are NOT valid surrogates, then the result is indeterminate. The isSurrogatePair(char, char) method should be used prior to this method to validate the pair.

Parameters:
high - The high surrogate unit.
low - The low surrogate unit.
Returns:
The decoded code point.
Since:
1.5
See Also:
isSurrogatePair(char, char)

codePointAt

public static int codePointAt(CharSequence seq,
                              int index)

Returns the code point at the index in the CharSequence. If char unit at the index is a high-surrogate unit, the next index is less than the length of the sequence and the char unit at the next index is a low surrogate unit, then the code point represented by the pair is returned; otherwise the char unit at the index is returned.

Parameters:
seq - The sequence of char units.
index - The index into the seq to retrieve and convert.
Returns:
The Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if the index is negative or greater than or equal to seq.length().
Since:
1.5

codePointAt

public static int codePointAt(char[] seq,
                              int index)

Returns the code point at the index in the char[]. If char unit at the index is a high-surrogate unit, the next index is less than the length of the sequence and the char unit at the next index is a low surrogate unit, then the code point represented by the pair is returned; otherwise the char unit at the index is returned.

Parameters:
seq - The sequence of char units.
index - The index into the seq to retrieve and convert.
Returns:
The Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if the index is negative or greater than or equal to seq.length().
Since:
1.5

codePointAt

public static int codePointAt(char[] seq,
                              int index,
                              int limit)

Returns the code point at the index in the char[] that's within the limit. If char unit at the index is a high-surrogate unit, the next index is less than the limit and the char unit at the next index is a low surrogate unit, then the code point represented by the pair is returned; otherwise the char unit at the index is returned.

Parameters:
seq - The sequence of char units.
index - The index into the seq to retrieve and convert.
limit - The exclusive index into the seq that marks the end of the units that can be used.
Returns:
The Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if the index is negative, greater than or equal to limit, limit is negative or limit is greater than the length of seq.
Since:
1.5

codePointBefore

public static int codePointBefore(CharSequence seq,
                                  int index)

Returns the Unicode code point that proceeds the index in the CharSequence. If the char unit at index - 1 is within the low surrogate range, the value index - 2 isn't negative and the char unit at index - 2 is within the high surrogate range, then the supplementary code point made up of the surrogate pair is returned; otherwise, the char value at index - 1 is returned.

Parameters:
seq - The CharSequence to search.
index - The index into the seq.
Returns:
A Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if index is less than 1 or greater than seq.length().
Since:
1.5

codePointBefore

public static int codePointBefore(char[] seq,
                                  int index)

Returns the Unicode code point that proceeds the index in the char[]. If the char unit at index - 1 is within the low surrogate range, the value index - 2 isn't negative and the char unit at index - 2 is within the high surrogate range, then the supplementary code point made up of the surrogate pair is returned; otherwise, the char value at index - 1 is returned.

Parameters:
seq - The char[] to search.
index - The index into the seq.
Returns:
A Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if index is less than 1 or greater than seq.length.
Since:
1.5

codePointBefore

public static int codePointBefore(char[] seq,
                                  int index,
                                  int start)

Returns the Unicode code point that proceeds the index in the char[] and isn't less than start. If the char unit at index - 1 is within the low surrogate range, the value index - 2 isn't less than start and the char unit at index - 2 is within the high surrogate range, then the supplementary code point made up of the surrogate pair is returned; otherwise, the char value at index - 1 is returned.

Parameters:
seq - The char[] to search.
index - The index into the seq.
Returns:
A Unicode code point.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if index is less than or equal to start, index is greater than seq.length, start is not negative and start is greater than seq.length.
Since:
1.5

toChars

public static int toChars(int codePoint,
                          char[] dst,
                          int dstIndex)

Converts the Unicode code point, codePoint, into a UTF-16 encoded sequence and copies the value(s) into the char[] dst, starting at the index dstIndex.

Parameters:
codePoint - The Unicode code point to encode.
dst - The char[] to copy the encoded value into.
dstIndex - The index to start copying into dst.
Returns:
The number of char value units copied into dst.
Throws:
IllegalArgumentException - if codePoint is not a valid Unicode code point.
NullPointerException - if dst is null.
IndexOutOfBoundsException - if dstIndex is negative, greater than or equal to dst.length or equals dst.length - 1 when codePoint is a supplementary code point.
Since:
1.5

toChars

public static char[] toChars(int codePoint)

Converts the Unicode code point, codePoint, into a UTF-16 encoded sequence that is returned as a char[].

Parameters:
codePoint - The Unicode code point to encode.
Returns:
The UTF-16 encoded char sequence; if code point is a supplementary code point, then a 2 char array is returned, otherwise a 1 char array is returned.
Throws:
IllegalArgumentException - if codePoint is not a valid Unicode code point.
Since:
1.5

codePointCount

public static int codePointCount(CharSequence seq,
                                 int beginIndex,
                                 int endIndex)

Counts the number of Unicode code points in the subsequence of the CharSequence, as delineated by the beginIndex and endIndex. Any surrogate values with missing pair values will be counted as 1 code point.

Parameters:
seq - The CharSequence to look through.
beginIndex - The inclusive index to begin counting at.
endIndex - The exclusive index to stop counting at.
Returns:
The number of Unicode code points.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if beginIndex is negative, greater than seq.length() or greater than endIndex.
Since:
1.5

codePointCount

public static int codePointCount(char[] seq,
                                 int offset,
                                 int count)

Counts the number of Unicode code points in the subsequence of the char[], as delineated by the offset and count. Any surrogate values with missing pair values will be counted as 1 code point.

Parameters:
seq - The char[] to look through.
offset - The inclusive index to begin counting at.
count - The number of char values to look through in seq.
Returns:
The number of Unicode code points.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if offset or count is negative or if endIndex is greater than seq.length.
Since:
1.5

offsetByCodePoints

public static int offsetByCodePoints(CharSequence seq,
                                     int index,
                                     int codePointOffset)

Determines the index into the CharSequence that is offset (measured in code points and specified by codePointOffset), from the index argument.

Parameters:
seq - The CharSequence to find the index within.
index - The index to begin from, within the CharSequence.
codePointOffset - The number of code points to look back or forwards; may be a negative or positive value.
Returns:
The calculated index that is codePointOffset code points from index.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if index is negative, greater than seq.length(), there aren't enough values in seq after index or before index if codePointOffset is negative.
Since:
1.5

offsetByCodePoints

public static int offsetByCodePoints(char[] seq,
                                     int start,
                                     int count,
                                     int index,
                                     int codePointOffset)

Determines the index into the char[] that is offset (measured in code points and specified by codePointOffset), from the index argument and is within the subsequence as delineated by start and count.

Parameters:
seq - The char[] to find the index within.
index - The index to begin from, within the char[].
codePointOffset - The number of code points to look back or forwards; may be a negative or positive value.
start - The inclusive index that marks the beginning of the subsequence.
count - The number of char values to include within the subsequence.
Returns:
The calculated index that is codePointOffset code points from index.
Throws:
NullPointerException - if seq is null.
IndexOutOfBoundsException - if start or count is negative, start + count greater than seq.length, index is less than start, index is greater than start + count or there aren't enough values in seq after index or before index if codePointOffset is negative.
Since:
1.5

digit

public static int digit(char c,
                        int radix)
Convenient method to determine the value of character c in the supplied radix. The value of radix must be between MIN_RADIX and MAX_RADIX.

Parameters:
c - the character
radix - the radix
Returns:
if radix lies between MIN_RADIX and MAX_RADIX then the value of the character in the radix, otherwise -1.

digit

public static int digit(int codePoint,
                        int radix)
Convenient method to determine the value of character codePoint in the supplied radix. The value of radix must be between MIN_RADIX and MAX_RADIX.

Parameters:
codePoint - the character, including supplementary characters
radix - the radix
Returns:
if radix lies between MIN_RADIX and MAX_RADIX then the value of the character in the radix, otherwise -1.

equals

public boolean equals(Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

In this case, the argument must also be a Character, and the receiver and argument must represent the same char value.

Overrides:
equals in class Object
Parameters:
object - the object to compare with this object
Returns:
true if the object is the same as this object false if it is different from this object
See Also:
hashCode()

forDigit

public static char forDigit(int digit,
                            int radix)
Returns the character which represents the value in the specified radix. The radix must be between MIN_RADIX and MAX_RADIX inclusive.

Parameters:
digit - the integer value
radix - the radix
Returns:
the character which represents the value in the radix

getNumericValue

public static int getNumericValue(char c)
Gets the numeric value of the Unicode character.

Parameters:
c - the character
Returns:
a numeric int value >= 0, -1 if there is no numeric value, -2 if the numeric value is not an int >= 0

getNumericValue

public static int getNumericValue(int codePoint)
Gets the numeric value of the Unicode character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
a numeric int value which is not negative, -1 if there is no numeric value, -2 if the numeric value is negative

getType

public static int getType(char c)
Gets the general Unicode category of the specified character.

Parameters:
c - the character
Returns:
the Unicode category

getType

public static int getType(int codePoint)
Gets the general Unicode category of the specified character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
the Unicode category

getDirectionality

public static byte getDirectionality(char c)
Gets the Unicode directionality of the specified character.

Parameters:
c - the character
Returns:
the Unicode directionality

getDirectionality

public static byte getDirectionality(int codePoint)
Gets the Unicode directionality of the specified character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
the Unicode directionality

isMirrored

public static boolean isMirrored(char c)
Returns whether the specified character is mirrored

Parameters:
c - the character
Returns:
true if the character is mirrored, false otherwise

isMirrored

public static boolean isMirrored(int codePoint)
Returns whether the specified character is mirrored

Parameters:
codePoint - the character, including supplementary characters
Returns:
true if the character is mirrored, false otherwise

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects which answer true when passed to equals must answer the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

isDefined

public static boolean isDefined(char c)
Returns whether the specified character is defined in the Unicode specification.

Parameters:
c - the character
Returns:
true if the general Unicode category of the character is not UNASSIGNED, false otherwise

isDefined

public static boolean isDefined(int codePoint)
Returns whether the specified character is defined in the Unicode specification.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true if the general Unicode category of the character is not UNASSIGNED, false otherwise

isDigit

public static boolean isDigit(char c)
Returns whether the character is a digit.

Parameters:
c - the character
Returns:
true when the character is a digit, false otherwise

isDigit

public static boolean isDigit(int codePoint)
Returns whether the character is a digit.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a digit, false otherwise

isIdentifierIgnorable

public static boolean isIdentifierIgnorable(char c)
Returns whether the specified character is ignorable in a Java or Unicode identifier.

Parameters:
c - the character
Returns:
true when the character is ignorable, false otherwise

isIdentifierIgnorable

public static boolean isIdentifierIgnorable(int codePoint)
Returns whether the specified character is ignorable in a Java or Unicode identifier.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is ignorable, false otherwise

isISOControl

public static boolean isISOControl(char c)
Returns whether the character is an ISO control character.

Parameters:
c - the character
Returns:
true if c is an ISO control character, otherwise false

isISOControl

public static boolean isISOControl(int c)
Returns whether the character is an ISO control character.

Parameters:
c - the character, including supplementary characters
Returns:
true if c is an ISO control character, otherwise false

isJavaIdentifierPart

public static boolean isJavaIdentifierPart(char c)
Returns whether the character is a valid part of a Unicode identifier as other than the first character.

Parameters:
c - the character
Returns:
true when the character is valid as part of a Java identifier, false otherwise

isJavaIdentifierPart

public static boolean isJavaIdentifierPart(int codePoint)
Returns whether the character is a valid part of a Unicode identifier as other than the first character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is valid as part of a Java identifier, false otherwise

isJavaIdentifierStart

public static boolean isJavaIdentifierStart(char c)
Returns whether the character is a valid start of a Unicode identifier

Parameters:
c - the character
Returns:
true when the character is a valid start of a Java identifier, false otherwise

isJavaIdentifierStart

public static boolean isJavaIdentifierStart(int codePoint)
Returns whether the character is a valid start of a Unicode identifier

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a valid start of a Java identifier, false otherwise

isJavaLetter

@Deprecated
public static boolean isJavaLetter(char c)
Deprecated. Use isJavaIdentifierStart(char)

Returns whether the character is a Java letter.


isJavaLetterOrDigit

@Deprecated
public static boolean isJavaLetterOrDigit(char c)
Deprecated. Use isJavaIdentifierPart(char)

Returns whether the character is a Java letter or digit character.


isLetter

public static boolean isLetter(char c)
Returns whether the character is a letter.

Parameters:
c - the character
Returns:
true when the character is a letter, false otherwise

isLetter

public static boolean isLetter(int codePoint)
Returns whether the character is a letter.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a letter, false otherwise

isLetterOrDigit

public static boolean isLetterOrDigit(char c)
Returns whether the character is a letter or a digit.

Parameters:
c - the character
Returns:
true when the character is a letter or a digit, false otherwise

isLetterOrDigit

public static boolean isLetterOrDigit(int codePoint)
Returns whether the character is a letter or a digit.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a letter or a digit, false otherwise

isLowerCase

public static boolean isLowerCase(char c)
Returns whether the character is a lower case letter.

Parameters:
c - the character
Returns:
true when the character is a lower case letter, false otherwise

isLowerCase

public static boolean isLowerCase(int codePoint)
Returns whether the character is a lower case letter.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a lower case letter, false otherwise

isSpace

@Deprecated
public static boolean isSpace(char c)
Deprecated. Use isWhitespace(char)

Returns whether the character is a Java space.


isSpaceChar

public static boolean isSpaceChar(char c)
Returns whether the character is a Unicode space character. A member of one of the Unicode categories Space Separator, Line Separator, or Paragraph Separator.

Parameters:
c - the character
Returns:
true when the character is a Unicode space character, false otherwise

isSpaceChar

public static boolean isSpaceChar(int codePoint)
Returns whether the character is a Unicode space character. A member of one of the Unicode categories Space Separator, Line Separator, or Paragraph Separator.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a Unicode space character, false otherwise

isTitleCase

public static boolean isTitleCase(char c)
Returns whether the character is a titlecase character.

Parameters:
c - the character
Returns:
true when the character is a titlecase character, false otherwise

isTitleCase

public static boolean isTitleCase(int codePoint)
Returns whether the character is a titlecase character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a titlecase character, false otherwise

isUnicodeIdentifierPart

public static boolean isUnicodeIdentifierPart(char c)
Returns whether the character is valid as part of a Unicode identifier as other than the first character.

Parameters:
c - the character
Returns:
true when the character is valid as part of a Unicode identifier, false otherwise

isUnicodeIdentifierPart

public static boolean isUnicodeIdentifierPart(int codePoint)
Returns whether the character is valid as part of a Unicode identifier as other than the first character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is valid as part of a Unicode identifier, false otherwise

isUnicodeIdentifierStart

public static boolean isUnicodeIdentifierStart(char c)
Returns whether the character is a valid initial character for a Unicode identifier.

Parameters:
c - the character
Returns:
true when the character is a valid start of a Unicode identifier, false otherwise

isUnicodeIdentifierStart

public static boolean isUnicodeIdentifierStart(int codePoint)
Returns whether the character is a valid initial character for a Unicode identifier.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a valid start of a Unicode identifier, false otherwise

isUpperCase

public static boolean isUpperCase(char c)
Returns whether the character is an upper case letter.

Parameters:
c - the character
Returns:
true when the character is a upper case letter, false otherwise

isUpperCase

public static boolean isUpperCase(int codePoint)
Returns whether the character is an upper case letter.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true when the character is a upper case letter, false otherwise

isWhitespace

public static boolean isWhitespace(char c)
Returns whether the character is a whitespace character in Java.

Parameters:
c - the character
Returns:
true if the supplied c is a whitespace character in Java, otherwise false.

isWhitespace

public static boolean isWhitespace(int codePoint)
Returns whether the character is a whitespace character in Java.

Parameters:
codePoint - the character, including supplementary characters
Returns:
true if the supplied c is a whitespace character in Java, otherwise false.

reverseBytes

public static char reverseBytes(char c)
Reverse the order of the first and second bytes in character

Parameters:
c - the character
Returns:
the character with reordered bytes.

toLowerCase

public static char toLowerCase(char c)
Returns the lower case equivalent for the character when the character is an upper case letter, otherwise returns the character.

Parameters:
c - the character
Returns:
if c is not a lower case character then its lower case counterpart, otherwise just c

toLowerCase

public static int toLowerCase(int codePoint)
Returns the lower case equivalent for the character when the character is an upper case letter, otherwise returns the character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
if codePoint is not a lower case character then its lower case counterpart, otherwise just codePoint

toString

public String toString()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

toString

public static String toString(char value)
Converts the specified character to its string representation.

Parameters:
value - the character
Returns:
the character converted to a string

toTitleCase

public static char toTitleCase(char c)
Returns the title case equivalent for the character, otherwise returns the character.

Parameters:
c - the character
Returns:
the title case equivalent of the character

toTitleCase

public static int toTitleCase(int codePoint)
Returns the title case equivalent for the character, otherwise returns the character.

Parameters:
codePoint - the character
Returns:
the title case equivalent of the character

toUpperCase

public static char toUpperCase(char c)
Returns the upper case equivalent for the character when the character is a lower case letter, otherwise returns the character.

Parameters:
c - the character
Returns:
if c is not an upper case character then its upper case counterpart, otherwise just c

toUpperCase

public static int toUpperCase(int codePoint)
Returns the upper case equivalent for the character when the character is a lower case letter, otherwise returns the character.

Parameters:
codePoint - the character, including supplementary characters
Returns:
if codePoint is not an upper case character then its upper case counterpart, otherwise just codePoint

Build 1.0_r1(from source)

Please submit a feedback, bug or feature