java.lang

Class Character

Implemented Interfaces:
Comparable, Serializable

public final class Character
extends Object
implements Serializable, Comparable

Wrapper class for the primitive char data type. In addition, this class allows one to retrieve property information and perform transformations on the 57,707 defined characters in the Unicode Standard, Version 3.0.0. java.lang.Character is designed to be very dynamic, and as such, it retrieves information on the Unicode character set from a separate database, gnu.java.lang.CharData, which can be easily upgraded.

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 3.0, for the boundary specification.

See http://www.unicode.org for more information on the Unicode Standard.

Since:
1.0

See Also:
CharData, Serialized Form

Nested Class Summary

static class
Character.Subset
A subset of Unicode blocks.
static class
Character.UnicodeBlock
A family of character subsets in the Unicode specification.

Field Summary

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_RADIX
Largest value allowed for radix arguments in Java.
static char
MAX_VALUE
The maximum value the char data type can hold.
static int
MIN_RADIX
Smallest value allowed for radix arguments in Java.
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 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
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 Summary

Character(char value)
Wraps up a character.

Method Summary

char
charValue()
Returns the character which has been wrapped by this class.
int
compareTo(Character anotherCharacter)
Compares another Character to this Character, numerically.
int
compareTo(Object o)
Compares an object to this Character.
static int
digit(char ch, 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 int
getNumericValue(char ch)
Returns the Unicode numeric value property of a character.
static int
getType(char ch)
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
isDigit(char ch)
Determines if a character is a Unicode decimal digit.
static boolean
isISOControl(char ch)
Determines if a character has the ISO Control property.
static boolean
isIdentifierIgnorable(char ch)
Determines if a character is ignorable in a Unicode identifier.
static boolean
isJavaIdentifierPart(char ch)
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
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
isLetterOrDigit(char ch)
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
isMirrored(char ch)
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
isTitleCase(char ch)
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
isUnicodeIdentifierStart(char ch)
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
isWhitespace(char ch)
Determines if a character is Java whitespace.
static char
toLowerCase(char ch)
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 char
toUpperCase(char ch)
Converts a Unicode character into its uppercase equivalent mapping.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

COMBINING_SPACING_MARK

public static final byte COMBINING_SPACING_MARK
Mc = Mark, Spacing Combining (Normative).

Field Value:
8

Since:
1.1


CONNECTOR_PUNCTUATION

public static final byte CONNECTOR_PUNCTUATION
Pc = Punctuation, Connector (Informative).

Field Value:
23

Since:
1.1


CONTROL

public static final byte CONTROL
Cc = Other, Control (Normative).

Field Value:
15

Since:
1.1


CURRENCY_SYMBOL

public static final byte CURRENCY_SYMBOL
Sc = Symbol, Currency (Informative).

Field Value:
26

Since:
1.1


DASH_PUNCTUATION

public static final byte DASH_PUNCTUATION
Pd = Punctuation, Dash (Informative).

Field Value:
20

Since:
1.1


DECIMAL_DIGIT_NUMBER

public static final byte DECIMAL_DIGIT_NUMBER
Nd = Number, Decimal Digit (Normative).

Field Value:
9

Since:
1.1


DIRECTIONALITY_ARABIC_NUMBER

public static final byte DIRECTIONALITY_ARABIC_NUMBER
Weak bidirectional character type "AN".

Field Value:
6

Since:
1.4


DIRECTIONALITY_BOUNDARY_NEUTRAL

public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL
Weak bidirectional character type "BN".

Field Value:
9

Since:
1.4


DIRECTIONALITY_COMMON_NUMBER_SEPARATOR

public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
Weak bidirectional character type "CS".

Field Value:
7

Since:
1.4


DIRECTIONALITY_EUROPEAN_NUMBER

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER
Weak bidirectional character type "EN".

Field Value:
3

Since:
1.4


DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
Weak bidirectional character type "ES".

Field Value:
4

Since:
1.4


DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR

public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
Weak bidirectional character type "ET".

Field Value:
5

Since:
1.4


DIRECTIONALITY_LEFT_TO_RIGHT

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT
Strong bidirectional character type "L".

Field Value:
0

Since:
1.4


DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
Strong bidirectional character type "LRE".

Field Value:
14

Since:
1.4


DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE

public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
Strong bidirectional character type "LRO".

Field Value:
15

Since:
1.4


DIRECTIONALITY_NONSPACING_MARK

public static final byte DIRECTIONALITY_NONSPACING_MARK
Weak bidirectional character type "NSM".

Field Value:
8

Since:
1.4


DIRECTIONALITY_OTHER_NEUTRALS

public static final byte DIRECTIONALITY_OTHER_NEUTRALS
Neutral bidirectional character type "ON".

Field Value:
13

Since:
1.4


DIRECTIONALITY_PARAGRAPH_SEPARATOR

public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR
Neutral bidirectional character type "B".

Field Value:
10

Since:
1.4


DIRECTIONALITY_POP_DIRECTIONAL_FORMAT

public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
Weak bidirectional character type "PDF".

Field Value:
18

Since:
1.4


DIRECTIONALITY_RIGHT_TO_LEFT

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT
Strong bidirectional character type "R".

Field Value:
1

Since:
1.4


DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
Strong bidirectional character type "AL".

Field Value:
2

Since:
1.4


DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
Strong bidirectional character type "RLE".

Field Value:
16

Since:
1.4


DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE

public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
Strong bidirectional character type "RLO".

Field Value:
17

Since:
1.4


DIRECTIONALITY_SEGMENT_SEPARATOR

public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR
Neutral bidirectional character type "S".

Field Value:
11

Since:
1.4


DIRECTIONALITY_UNDEFINED

public static final byte DIRECTIONALITY_UNDEFINED
Undefined bidirectional character type. Undefined char values have undefined directionality in the Unicode specification.

Field Value:
-1

Since:
1.4


DIRECTIONALITY_WHITESPACE

public static final byte DIRECTIONALITY_WHITESPACE
Strong bidirectional character type "WS".

Field Value:
12

Since:
1.4


ENCLOSING_MARK

public static final byte ENCLOSING_MARK
Me = Mark, Enclosing (Normative).

Field Value:
7

Since:
1.1


END_PUNCTUATION

public static final byte END_PUNCTUATION
Pe = Punctuation, Close (Informative).

Field Value:
22

Since:
1.1


FINAL_QUOTE_PUNCTUATION

public static final byte FINAL_QUOTE_PUNCTUATION
Pf = Punctuation, Final Quote (Informative).

Field Value:
30

Since:
1.4


FORMAT

public static final byte FORMAT
Cf = Other, Format (Normative).

Field Value:
16

Since:
1.1


INITIAL_QUOTE_PUNCTUATION

public static final byte INITIAL_QUOTE_PUNCTUATION
Pi = Punctuation, Initial Quote (Informative).

Field Value:
29

Since:
1.4


LETTER_NUMBER

public static final byte LETTER_NUMBER
Nl = Number, Letter (Normative).

Field Value:
10

Since:
1.1


LINE_SEPARATOR

public static final byte LINE_SEPARATOR
Zl = Separator, Line (Normative).

Field Value:
13

Since:
1.1


LOWERCASE_LETTER

public static final byte LOWERCASE_LETTER
Ll = Letter, Lowercase (Informative).

Field Value:
2

Since:
1.1


MATH_SYMBOL

public static final byte MATH_SYMBOL
Sm = Symbol, Math (Informative).

Field Value:
25

Since:
1.1


MAX_RADIX

public static final int MAX_RADIX
Largest value allowed for radix arguments in Java. This value is 36.

Field Value:
36

See Also:
digit(char,int), forDigit(int,int), Integer.toString(int,int), Integer.valueOf(String)


MAX_VALUE

public static final char MAX_VALUE
The maximum value the char data type can hold. This value is '\\uFFFF'.


MIN_RADIX

public static final int MIN_RADIX
Smallest value allowed for radix arguments in Java. This value is 2.

Field Value:
2

See Also:
digit(char,int), forDigit(int,int), Integer.toString(int,int), Integer.valueOf(String)


MIN_VALUE

public static final char MIN_VALUE
The minimum value the char data type can hold. This value is '\\u0000'.


MODIFIER_LETTER

public static final byte MODIFIER_LETTER
Lm = Letter, Modifier (Informative).

Field Value:
4

Since:
1.1


MODIFIER_SYMBOL

public static final byte MODIFIER_SYMBOL
Sk = Symbol, Modifier (Informative).

Field Value:
27

Since:
1.1


NON_SPACING_MARK

public static final byte NON_SPACING_MARK
Mn = Mark, Non-Spacing (Normative).

Field Value:
6

Since:
1.1


OTHER_LETTER

public static final byte OTHER_LETTER
Lo = Letter, Other (Informative).

Field Value:
5

Since:
1.1


OTHER_NUMBER

public static final byte OTHER_NUMBER
No = Number, Other (Normative).

Field Value:
11

Since:
1.1


OTHER_PUNCTUATION

public static final byte OTHER_PUNCTUATION
Po = Punctuation, Other (Informative).

Field Value:
24

Since:
1.1


OTHER_SYMBOL

public static final byte OTHER_SYMBOL
So = Symbol, Other (Informative).

Field Value:
28

Since:
1.1


PARAGRAPH_SEPARATOR

public static final byte PARAGRAPH_SEPARATOR
Zp = Separator, Paragraph (Normative).

Field Value:
14

Since:
1.1


PRIVATE_USE

public static final byte PRIVATE_USE
Co = Other, Private Use (Normative).

Field Value:
18

Since:
1.1


SPACE_SEPARATOR

public static final byte SPACE_SEPARATOR
Zs = Separator, Space (Normative).

Field Value:
12

Since:
1.1


START_PUNCTUATION

public static final byte START_PUNCTUATION
Ps = Punctuation, Open (Informative).

Field Value:
21

Since:
1.1


SURROGATE

public static final byte SURROGATE
Cs = Other, Surrogate (Normative).

Field Value:
19

Since:
1.1


TITLECASE_LETTER

public static final byte TITLECASE_LETTER
Lt = Letter, Titlecase (Informative).

Field Value:
3

Since:
1.1


TYPE

public static final Class TYPE
Class object representing the primitive char data type.

Since:
1.1


UNASSIGNED

public static final byte UNASSIGNED
Cn = Other, Not Assigned (Normative).

Field Value:
0

Since:
1.1


UPPERCASE_LETTER

public static final byte UPPERCASE_LETTER
Lu = Letter, Uppercase (Informative).

Field Value:
1

Since:
1.1

Constructor Details

Character

public Character(char value)
Wraps up a character.

Parameters:
value - the character to wrap

Method Details

charValue

public char charValue()
Returns the character which has been wrapped by this class.

Returns:
the character wrapped


compareTo

public int compareTo(Character anotherCharacter)
Compares another Character to this Character, numerically.

Parameters:
anotherCharacter - Character to compare with this Character

Returns:
a negative integer if this Character is less than anotherCharacter, zero if this Character is equal, and a positive integer if this Character is greater

Throws:
NullPointerException - if anotherCharacter is null

Since:
1.2


compareTo

public int compareTo(Object o)
Compares an object to this Character. Assuming the object is a Character object, this method performs the same comparison as compareTo(Character).
Specified by:
compareTo in interface Comparable

Parameters:
o - object to compare

Returns:
the comparison value

Throws:
ClassCastException - if o is not a Character object
NullPointerException - if o is null

Since:
1.2

See Also:
compareTo(Character)


digit

public static int digit(char ch,
                        int radix)
Converts a character into a digit of the specified radix. If the radix exceeds MIN_RADIX or MAX_RADIX, or if the result of getNumericValue(ch) exceeds the radix, or if ch is not a decimal digit or in the case insensitive set of 'a'-'z', the result is -1.
character argument boundary = [Nd]|U+0041-U+005A|U+0061-U+007A |U+FF21-U+FF3A|U+FF41-U+FF5A

Parameters:
ch - character to convert into a digit
radix - radix in which ch is a digit

Returns:
digit which ch represents in radix, or -1 not a valid digit

See Also:
MIN_RADIX, MAX_RADIX, forDigit(int,int), isDigit(char), getNumericValue(char)


equals

public boolean equals(Object o)
Determines if an object is equal to this object. This is only true for another Character object wrapping the same value.
Overrides:
equals in interface Object

Parameters:
o - object to compare

Returns:
true if o is a Character with the same value


forDigit

public static char forDigit(int digit,
                            int radix)
Converts a digit into a character which represents that digit in a specified radix. If the radix exceeds MIN_RADIX or MAX_RADIX, or the digit exceeds the radix, then the null character '\0' is returned. Otherwise the return value is in '0'-'9' and 'a'-'z'.
return value boundary = U+0030-U+0039|U+0061-U+007A

Parameters:
digit - digit to be converted into a character
radix - radix of digit

Returns:
character representing digit in radix, or '\0'

See Also:
MIN_RADIX, MAX_RADIX, digit(char,int)


getDirectionality

public static byte getDirectionality(char ch)
Returns the Unicode directionality property of the character. This is used in the visual ordering of text.

Parameters:
ch - the character to look up

Returns:
the directionality constant, or DIRECTIONALITY_UNDEFINED

Since:
1.4

See Also:
DIRECTIONALITY_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


getNumericValue

public static int getNumericValue(char ch)
Returns the Unicode numeric value property of a character. For example, '\\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: '\u0041' through '\u005A' (uppercase); '\u0061' through '\u007A' (lowercase); and '\uFF21' through '\uFF3A', '\uFF41' through '\uFF5A' (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

Parameters:
ch - character from which the numeric value property will be retrieved

Returns:
the numeric value property of ch, or -1 if it does not exist, or -2 if it is not representable as a nonnegative integer

Since:
1.1

See Also:
forDigit(int,int), digit(char,int), isDigit(char)


getType

public static int getType(char ch)
Returns the Unicode general category property of a character.

Parameters:
ch - character from which the general category property will be retrieved

Returns:
the character category property of ch as an integer

Since:
1.1

See Also:
UNASSIGNED, 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


hashCode

public int hashCode()
Returns the numerical value (unsigned) of the wrapped character. Range of returned values: 0x0000-0xFFFF.
Overrides:
hashCode in interface Object

Returns:
the value of the wrapped character


isDefined

public static boolean isDefined(char ch)
Determines if a character is part of the Unicode Standard. This is an evolving standard, but covers every character in the data file.
defined = not [Cn]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode character, else false

See Also:
isDigit(char), isLetter(char), isLetterOrDigit(char), isLowerCase(char), isTitleCase(char), isUpperCase(char)


isDigit

public static boolean isDigit(char ch)
Determines if a character is a Unicode decimal digit. For example, '0' is a digit.
Unicode decimal digit = [Nd]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode decimal digit, else false

See Also:
digit(char,int), forDigit(int,int), getType(char)


isISOControl

public static boolean isISOControl(char ch)
Determines if a character has the ISO Control property.
ISO Control = [Cc]

Parameters:
ch - character to test

Returns:
true if ch is an ISO Control character, else false

Since:
1.1

See Also:
isSpaceChar(char), isWhitespace(char)


isIdentifierIgnorable

public static boolean isIdentifierIgnorable(char ch)
Determines if a character is ignorable in a Unicode identifier. This includes the non-whitespace ISO control characters ('\u0000' through '\u0008', '\u000E' through '\u001B', and '\u007F' through '\u009F'), and FORMAT characters.
Unicode identifier ignorable = [Cf]|U+0000-U+0008|U+000E-U+001B |U+007F-U+009F

Parameters:
ch - character to test

Returns:
true if ch is ignorable in a Unicode or Java identifier

Since:
1.1

See Also:
isJavaIdentifierPart(char), isUnicodeIdentifierPart(char)


isJavaIdentifierPart

public static boolean isJavaIdentifierPart(char ch)
Determines if a character can follow the first letter in a Java identifier. This is the combination of isJavaLetter (isLetter, type of LETTER_NUMBER, currency, connecting punctuation) and digit, numeric letter (like Roman numerals), combining marks, non-spacing marks, or isIdentifierIgnorable.
Java identifier extender = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Sc]|[Pc]|[Mn]|[Mc]|[Nd]|[Cf] |U+0000-U+0008|U+000E-U+001B|U+007F-U+009F

Parameters:
ch - character to test

Returns:
true if ch can follow the first letter in a Java identifier

Since:
1.1

See Also:
isIdentifierIgnorable(char), isJavaIdentifierStart(char), isLetterOrDigit(char), isUnicodeIdentifierPart(char)


isJavaIdentifierStart

public static boolean isJavaIdentifierStart(char ch)
Determines if a character can start a Java identifier. This is the combination of isLetter, any character where getType returns LETTER_NUMBER, currency symbols (like '$'), and connecting punctuation (like '_').
Java identifier start = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Sc]|[Pc]

Parameters:
ch - character to test

Returns:
true if ch can start a Java identifier, else false

Since:
1.1

See Also:
isJavaIdentifierPart(char), isLetter(char), isUnicodeIdentifierStart(char)


isJavaLetter

public static boolean isJavaLetter(char ch)

Deprecated. Replaced by isJavaIdentifierStart(char)

Determines if a character can start a Java identifier. This is the combination of isLetter, any character where getType returns LETTER_NUMBER, currency symbols (like '$'), and connecting punctuation (like '_').

Parameters:
ch - character to test

Returns:
true if ch can start a Java identifier, else false

See Also:
isJavaLetterOrDigit(char), isJavaIdentifierStart(char), isJavaIdentifierPart(char), isLetter(char), isLetterOrDigit(char), isUnicodeIdentifierStart(char)


isJavaLetterOrDigit

public static boolean isJavaLetterOrDigit(char ch)

Deprecated. Replaced by isJavaIdentifierPart(char)

Determines if a character can follow the first letter in a Java identifier. This is the combination of isJavaLetter (isLetter, type of LETTER_NUMBER, currency, connecting punctuation) and digit, numeric letter (like Roman numerals), combining marks, non-spacing marks, or isIdentifierIgnorable.

Parameters:
ch - character to test

Returns:
true if ch can follow the first letter in a Java identifier

See Also:
isJavaLetter(char), isJavaIdentifierStart(char), isJavaIdentifierPart(char), isLetter(char), isLetterOrDigit(char), isUnicodeIdentifierPart(char), isIdentifierIgnorable(char)


isLetter

public static boolean isLetter(char ch)
Determines if a character is a Unicode letter. Not all letters have case, so this may return true when isLowerCase and isUpperCase return false.
letter = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode letter, else false

See Also:
isDigit(char), isJavaIdentifierStart(char), isJavaLetter(char), isJavaLetterOrDigit(char), isLetterOrDigit(char), isLowerCase(char), isTitleCase(char), isUnicodeIdentifierStart(char), isUpperCase(char)


isLetterOrDigit

public static boolean isLetterOrDigit(char ch)
Determines if a character is a Unicode letter or a Unicode digit. This is the combination of isLetter and isDigit.
letter or digit = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nd]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode letter or a Unicode digit, else false

See Also:
isDigit(char), isJavaIdentifierPart(char), isJavaLetter(char), isJavaLetterOrDigit(char), isLetter(char), isUnicodeIdentifierPart(char)


isLowerCase

public static boolean isLowerCase(char ch)
Determines if a character is a Unicode lowercase letter. For example, 'a' is lowercase.
lowercase = [Ll]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode lowercase letter, else false

See Also:
isUpperCase(char), isTitleCase(char), toLowerCase(char), getType(char)


isMirrored

public static boolean isMirrored(char ch)
Determines whether the character is mirrored according to Unicode. For example, \u0028 (LEFT PARENTHESIS) appears as '(' in left-to-right text, but ')' in right-to-left text.

Parameters:
ch - the character to look up

Returns:
true if the character is mirrored

Since:
1.4


isSpace

public static boolean isSpace(char ch)

Deprecated. Replaced by isWhitespace(char)

Determines if a character is a ISO-LATIN-1 space. This is only the five characters '\t', '\n', '\f', '\r', and ' '.
Java space = U+0020|U+0009|U+000A|U+000C|U+000D

Parameters:
ch - character to test

Returns:
true if ch is a space, else false

See Also:
isSpaceChar(char), isWhitespace(char)


isSpaceChar

public static boolean isSpaceChar(char ch)
Determines if a character is a Unicode space character. This includes SPACE_SEPARATOR, LINE_SEPARATOR, and PARAGRAPH_SEPARATOR.
Unicode space = [Zs]|[Zp]|[Zl]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode space, else false

Since:
1.1

See Also:
isWhitespace(char)


isTitleCase

public static boolean isTitleCase(char ch)
Determines if a character is a Unicode titlecase letter. For example, the character "Lj" (Latin capital L with small letter j) is titlecase.
titlecase = [Lt]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode titlecase letter, else false

See Also:
isLowerCase(char), isUpperCase(char), toTitleCase(char), getType(char)


isUnicodeIdentifierPart

public static boolean isUnicodeIdentifierPart(char ch)
Determines if a character can follow the first letter in a Unicode identifier. This includes letters, connecting punctuation, digits, numeric letters, combining marks, non-spacing marks, and isIdentifierIgnorable.
Unicode identifier extender = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Mn]|[Mc]|[Nd]|[Pc]|[Cf]| |U+0000-U+0008|U+000E-U+001B|U+007F-U+009F

Parameters:
ch - character to test

Returns:
true if ch can follow the first letter in a Unicode identifier

Since:
1.1

See Also:
isIdentifierIgnorable(char), isJavaIdentifierPart(char), isLetterOrDigit(char), isUnicodeIdentifierStart(char)


isUnicodeIdentifierStart

public static boolean isUnicodeIdentifierStart(char ch)
Determines if a character can start a Unicode identifier. Only letters can start a Unicode identifier, but this includes characters in LETTER_NUMBER.
Unicode identifier start = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]

Parameters:
ch - character to test

Returns:
true if ch can start a Unicode identifier, else false

Since:
1.1

See Also:
isJavaIdentifierStart(char), isLetter(char), isUnicodeIdentifierPart(char)


isUpperCase

public static boolean isUpperCase(char ch)
Determines if a character is a Unicode uppercase letter. For example, 'A' is uppercase.
uppercase = [Lu]

Parameters:
ch - character to test

Returns:
true if ch is a Unicode uppercase letter, else false

See Also:
isLowerCase(char), isTitleCase(char), toUpperCase(char), getType(char)


isWhitespace

public static boolean isWhitespace(char ch)
Determines if a character is Java whitespace. This includes Unicode space characters (SPACE_SEPARATOR, LINE_SEPARATOR, and PARAGRAPH_SEPARATOR) except the non-breaking spaces ('\u00A0', '\u2007', and '\u202F'); and these characters: '\u0009', '\u000A', '\u000B', '\u000C', '\u000D', '\u001C', '\u001D', '\u001E', and '\u001F'.
Java whitespace = ([Zs] not Nb)|[Zl]|[Zp]|U+0009-U+000D|U+001C-U+001F

Parameters:
ch - character to test

Returns:
true if ch is Java whitespace, else false

Since:
1.1

See Also:
isSpaceChar(char)


toLowerCase

public static char toLowerCase(char ch)
Converts a Unicode character into its lowercase equivalent mapping. If a mapping does not exist, then the character passed is returned. Note that isLowerCase(toLowerCase(ch)) does not always return true.

Parameters:
ch - character to convert to lowercase

Returns:
lowercase mapping of ch, or ch if lowercase mapping does not exist

See Also:
isLowerCase(char), isUpperCase(char), toTitleCase(char), toUpperCase(char)


toString

public String toString()
Converts the wrapped character into a String.
Overrides:
toString in interface Object

Returns:
a String containing one character -- the wrapped character of this instance


toString

public static String toString(char ch)
Returns a String of length 1 representing the specified character.

Parameters:
ch - the character to convert

Returns:
a String containing the character

Since:
1.4


toTitleCase

public static char toTitleCase(char ch)
Converts a Unicode character into its titlecase equivalent mapping. If a mapping does not exist, then the character passed is returned. Note that isTitleCase(toTitleCase(ch)) does not always return true.

Parameters:
ch - character to convert to titlecase

Returns:
titlecase mapping of ch, or ch if titlecase mapping does not exist

See Also:
isTitleCase(char), toLowerCase(char), toUpperCase(char)


toUpperCase

public static char toUpperCase(char ch)
Converts a Unicode character into its uppercase equivalent mapping. If a mapping does not exist, then the character passed is returned. Note that isUpperCase(toUpperCase(ch)) does not always return true.

Parameters:
ch - character to convert to uppercase

Returns:
uppercase mapping of ch, or ch if uppercase mapping does not exist

See Also:
isLowerCase(char), isUpperCase(char), toLowerCase(char), toTitleCase(char)


java.lang.Character -- Wrapper class for char, and Unicode subsets Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.