- java.lang.Object
-
- java.lang.Character
-
- All implemented interfaces
-
Serializable,Comparable<Character>
public final class Character extends Object implements Serializable, Comparable<Character>
CharacterThe class wraps a primitive type in an object.charthe value of. of typeCharacterThe object contains a single field whose type ischar。In addition, this class provides several methods for determining the category of a character (lowercase letter, digit, etc.) and for converting characters from uppercase to lowercase, and vice versa.
Character information is based on Unicode Standard version 10.0.0.
Class
Charactermethods and data byUnicodeDatadefined by the information in the file, which is part of the Unicode Character Database maintained by the Unicode Consortium. This file specifies various attributes, including the name and general category of each defined Unicode code point or character range.This file and its description are available from the Unicode Consortium:
Unicode Character Representations
chardata type (thereforeCharacterThe value encapsulated by the object) is based on the original Unicode specification, which defined characters as fixed-width 16-bit entities. Since then, the Unicode standard has changed to allow characters whose representation requires more than 16 bits. Validcode pointThe range of s is now U+0000 to U+10FFFF, calledUnicode scalar value 。 (see U+ in the Unicode Standardnof the representation. definition. )The set of characters from U+0000 to U+FFFFsometimes calledBasic Multilingual Plane (BMP) 。 Code points greater than U+FFFFCharactersCalledsupplementary character s。 The Java platform uses
charArrays andStringandStringBufferthe UTF-16 representation in the class. In this representation, supplementary characters are represented as a paircharvalue, the first fromhigh surrogateRange (\uD800-\uDBFF), the second comes fromlow surrogaterange (\uDC00-\uDFFF).Therefore,
charThe value represents a Basic Multilingual Plane (BMP) code point, including surrogate code points or UTF-16 encoded code units.intThe value represents all Unicode code points, including supplementary code points.intThe lower (least significant) 21 bits are used to represent the Unicode code point, while the higher (most significant) 11 bits must be zero. Unless otherwise specified, with respect to supplementary characters and surrogatescharthe behavior of the value is as follows:- only accepts
charMethods that take a value do not support supplementary characters. they will be in the surrogate rangecharThe value is treated as an undefined character. For example,Character.isLetter('\uD840')returnfalse, even if the particular value following any low surrogate value in this string also represents a letter. - Accept
intThe value method supports all Unicode characters, including supplementary characters. For example,Character.isLetter(0x2F81A)returntruebecause the code point value represents a letter (CJK ideograph).
In the Java SE API documentation,Unicode code pointUsed for character values between U+0000 and U+10FFFF,Unicode code unitused for 16-bit
charvalues, which areUTF-16the code units of the encoding. For more information on Unicode terminology, seeUnicode Glossary 。- Starting from the following version:
- 1.0
- See also:
- Serialized Form
-
-
Nested Class Summary
Nested class Variables and types Class Description static classCharacter.SubsetInstances of this class represent a specific subset of the Unicode character set.static classCharacter.UnicodeBlockA series of character subsets, representing character blocks in the Unicode specification.static classCharacter.UnicodeScripta series of character subsets, representingUnicode Standard Annex #24: Script NamesMediumthe defined character script.
-
Field Summary
Fields Variables and types Fields Description static intBYTESused to represent the unsigned binary form ofcharthe number of bytes in the value.static byteCOMBINING_SPACING_MARKGeneral category "Mc" in the Unicode specification.static byteCONNECTOR_PUNCTUATIONGeneral category "Pc" in the Unicode specification.static byteCONTROLGeneral category "Cc" in the Unicode specification.static byteCURRENCY_SYMBOLGeneral category "Sc" in the Unicode specification.static byteDASH_PUNCTUATIONGeneral category "Pd" in the Unicode specification.static byteDECIMAL_DIGIT_NUMBERGeneral category "Nd" in the Unicode specification.static byteDIRECTIONALITY_ARABIC_NUMBERThe weak bidirectional character type "AN" in the Unicode specification.static byteDIRECTIONALITY_BOUNDARY_NEUTRALThe weak bidirectional character type "BN" in the Unicode specification.static byteDIRECTIONALITY_COMMON_NUMBER_SEPARATORThe weak bidirectional character type "CS" in the Unicode specification.static byteDIRECTIONALITY_EUROPEAN_NUMBERThe weak bidirectional character type "EN" in the Unicode specification.static byteDIRECTIONALITY_EUROPEAN_NUMBER_SEPARATORThe weak bidirectional character type "ES" in the Unicode specification.static byteDIRECTIONALITY_EUROPEAN_NUMBER_TERMINATORThe weak bidirectional character type "ET" in the Unicode specification.static byteDIRECTIONALITY_FIRST_STRONG_ISOLATEThe weak bidirectional character type 'FSI' in the Unicode specification.static byteDIRECTIONALITY_LEFT_TO_RIGHTThe strong bidirectional character type "L" in the Unicode specification.static byteDIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDINGThe strong bidirectional character type 'LRE' in the Unicode specification.static byteDIRECTIONALITY_LEFT_TO_RIGHT_ISOLATEThe weak bidirectional character type "LRI" in the Unicode specification.static byteDIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDEThe strong bidirectional character type "LRO" in the Unicode specification.static byteDIRECTIONALITY_NONSPACING_MARKThe weak bidirectional character type "NSM" in the Unicode specification.static byteDIRECTIONALITY_OTHER_NEUTRALSThe neutral bidirectional character type "ON" in the Unicode specification.static byteDIRECTIONALITY_PARAGRAPH_SEPARATORThe neutral bidirectional character type "B" in the Unicode specification.static byteDIRECTIONALITY_POP_DIRECTIONAL_FORMATThe weak bidirectional character type "PDF" in the Unicode specification.static byteDIRECTIONALITY_POP_DIRECTIONAL_ISOLATEThe weak bidirectional character type "PDI" in the Unicode specification.static byteDIRECTIONALITY_RIGHT_TO_LEFTThe strong bidirectional character type 'R' in the Unicode specification.static byteDIRECTIONALITY_RIGHT_TO_LEFT_ARABICThe strong bidirectional character type "AL" in the Unicode specification.static byteDIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDINGThe strong bidirectional character type "RLE" in the Unicode specification.static byteDIRECTIONALITY_RIGHT_TO_LEFT_ISOLATEThe weak bidirectional character type "RLI" in the Unicode specification.static byteDIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDEThe strong bidirectional character type "RLO" in the Unicode specification.static byteDIRECTIONALITY_SEGMENT_SEPARATORThe neutral bidirectional character type "S" in the Unicode specification.static byteDIRECTIONALITY_UNDEFINEDUndefined bidirectional character type.static byteDIRECTIONALITY_WHITESPACEThe neutral bidirectional character type "WS" in the Unicode specification.static byteENCLOSING_MARKGeneral category "Me" in the Unicode specification.static byteEND_PUNCTUATIONGeneral category "Pe" in the Unicode specification.static byteFINAL_QUOTE_PUNCTUATIONGeneral category "Pf" in the Unicode specification.static byteFORMATGeneral category "Cf" in the Unicode specification.static byteINITIAL_QUOTE_PUNCTUATIONGeneral category "Pi" in the Unicode specification.static byteLETTER_NUMBERGeneral category "Nl" in the Unicode specification.static byteLINE_SEPARATORGeneral category "Zl" in the Unicode specification.static byteLOWERCASE_LETTERThe general category 'Ll' in the Unicode Standard.static byteMATH_SYMBOLThe general category 'Sm' in the Unicode Standard.static intMAX_CODE_POINTthe maximum value isUnicode code point, constantU+10FFFF。static charMAX_HIGH_SURROGATEthe maximum value in UTF-16 encodingUnicode high-surrogate code unit, constant'\uDBFF'。static charMAX_LOW_SURROGATEIn UTF-16 encodingUnicode low-surrogate code unitthe maximum value, constant'\uDFFF'。static intMAX_RADIXThe maximum radix available for conversion to and from strings.static charMAX_SURROGATEThe maximum value of a Unicode surrogate code unit in UTF-16 encoding, a constant.'\uDFFF'。static charMAX_VALUEThe constant value of this field is of typechar'\uFFFF'。static intMIN_CODE_POINTminimum valueUnicode code point, constantU+0000。static charMIN_HIGH_SURROGATEthe minimum value in UTF-16 encodingUnicode high-surrogate code unit, constant'\uD800'。static charMIN_LOW_SURROGATEIn UTF-16 encodingUnicode low-surrogate code unitthe minimum value, constant'\uDC00'。static intMIN_RADIXThe minimum radix available for conversion to and from strings.static intMIN_SUPPLEMENTARY_CODE_POINTminimum valueUnicode supplementary code point, constantU+10000。static charMIN_SURROGATEThe minimum value of a Unicode surrogate code unit in UTF-16 encoding, a constant.'\uD800'。static charMIN_VALUEThe constant value of this field is of typechar'\u0000'。static byteMODIFIER_LETTERThe general category 'Lm' in the Unicode Standard.static byteMODIFIER_SYMBOLThe general category 'Sk' in the Unicode Standard.static byteNON_SPACING_MARKThe general category 'Mn' in the Unicode Standard.static byteOTHER_LETTERThe general category 'Lo' in the Unicode Standard.static byteOTHER_NUMBERThe general category “No” in the Unicode specification.static byteOTHER_PUNCTUATIONThe general category 'Po' in the Unicode Standard.static byteOTHER_SYMBOLThe general category 'So' in the Unicode Standard.static bytePARAGRAPH_SEPARATORThe general category 'Zp' in the Unicode Standard.static bytePRIVATE_USEThe general category 'Co' in the Unicode Standard.static intSIZEused to represent the unsigned binary form ofcharthe number of bits in the value, constant16。static byteSPACE_SEPARATORThe general category 'Zs' in the Unicode Standard.static byteSTART_PUNCTUATIONThe general category 'Ps' in the Unicode Standard.static byteSURROGATEThe general category 'Cs' in the Unicode Standard.static byteTITLECASE_LETTERGeneral category 'Lt' in the Unicode specification.static 类<Character>TYPEClassthe instance represents a primitive typechar。static byteUNASSIGNEDGeneral category 'Cn' in the Unicode specification.static byteUPPERCASE_LETTERGeneral category 'Lu' in the Unicode specification.
-
Constructor Summary
Constructor Constructor Description Character(char value)deprecated.It is rarely appropriate to use this constructor.
-
Method Summary
All methods Static method Instance Methods Specific Methods Deprecated Methods Variables and types Methods Description static intcharCount(int codePoint)Determines what is required to represent the specified character (Unicode code point)charthe number of values.charcharValue()Return thisCharacterthe value of the object.static intcodePointAt(char[] a, int index)returncharthe code point at the given index of the array.static intcodePointAt(char[] a, int index, int limit)returncharThe code point at the given index of the array, where only ... can be usedindexless thanlimitarray elements.static intcodePointAt(CharSequence seq, int index)returnCharSequencethe code point at the given index.static intcodePointBefore(char[] a, int index)returncharThe code point before the given index in the array.static intcodePointBefore(char[] a, int index, int start)returncharThe code point before the given index in the array, where only can be usedindexgreater than or equal tostartarray elements.static intcodePointBefore(CharSequence seq, int index)returnCharSequencethe code point before the given index.static intcodePointCount(char[] a, int offset, int count)returncharThe number of Unicode code points in the subarray of the array argument.static intcodePointCount(CharSequence seq, int beginIndex, int endIndex)Returns the number of Unicode code points in the text range of the specified char sequence.static intcodePointOf(String name)Returns the code point value of the Unicode character specified by the given Unicode character name.static intcompare(char x, char y)Compares two numericallycharvalue.intcompareTo(Character anotherCharacter)Compares two numericallyCharacterObject.static intdigit(char ch, int radix)Returns the character in the specified radixchof the numeric value.static intdigit(int codePoint, int radix)Returns the numeric value of the specified character (Unicode code point) in the specified radix.booleanequals(Object obj)Compares this object with the specified object.static charforDigit(int digit, int radix)Determines the character representation for a specific digit in the specified radix.static bytegetDirectionality(char ch)Returns the Unicode directionality property of the given character.static bytegetDirectionality(int codePoint)Returns the Unicode directionality property of the given character (Unicode code point).static StringgetName(int codePoint)Returns the specified charactercodePointthe Unicode name of, if the code point isunassigned, then returns null.static intgetNumericValue(char ch)Returns the representation of the specified Unicode characterintvalue.static intgetNumericValue(int codePoint)Returns the representation of the specified character (Unicode code point)intvalue.static intgetType(char ch)Returns a value representing the general category of the character.static intgetType(int codePoint)Returns a value representing the general category of the character.inthashCode()Return thisCharacterthe hash code; equivalent to callingcharValue()the result of.static inthashCode(char value)returncharhash code of the value; andCharacter.hashCode()compatible.static charhighSurrogate(int codePoint)Returns the leading surrogate (ahigh surrogate code unitdescribed)surrogate pairRepresents the supplementary character (Unicode code point) specified in UTF-16 encoding.static booleanisAlphabetic(int codePoint)Determines whether the specified character (Unicode code point) is a letter.static booleanisBmpCodePoint(int codePoint)Determines whether the specified character (Unicode code point) is inIn the Basic Multilingual Plane (BMP) 。static booleanisDefined(char ch)Determines whether the character is defined in Unicode.static booleanisDefined(int codePoint)Determines whether the character (Unicode code point) is defined in Unicode.static booleanisDigit(char ch)Determines whether the specified character is a digit.static booleanisDigit(int codePoint)Determines whether the specified character (Unicode code point) is a digit.static booleanisHighSurrogate(char ch)determines the givencharwhether the value isUnicode high-surrogate code unit(also calledleading surrogate code unit )。static booleanisIdentifierIgnorable(char ch)Determines whether the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.static booleanisIdentifierIgnorable(int codePoint)Determines whether the specified character (Unicode code point) should be considered an ignorable character in a Java identifier or a Unicode identifier.static booleanisIdeographic(int codePoint)Determines whether the specified character (Unicode code point) is a CJKV (Chinese, Japanese, Korean, and Vietnamese) ideograph as defined by the Unicode Standard.static booleanisISOControl(char ch)Determines whether the specified character is an ISO control character.static booleanisISOControl(int codePoint)Determines whether the referenced character (Unicode code point) is an ISO control character.static booleanisJavaIdentifierPart(char ch)Determines whether the specified character may be part of a Java identifier as other than the first character.static booleanisJavaIdentifierPart(int codePoint)Determines whether a character (Unicode code point) is likely to be part of a Java identifier, but not the first character.static booleanisJavaIdentifierStart(char ch)Determines whether the specified character is allowed as the first character in a Java identifier.static booleanisJavaIdentifierStart(int codePoint)Determine whether a character (Unicode code point) is allowed as the first character in a Java identifier.static booleanisJavaLetter(char ch)deprecated.Replaced by isJavaIdentifierStart(char).static booleanisJavaLetterOrDigit(char ch)deprecated.Replaced by isJavaIdentifierPart(char).static booleanisLetter(char ch)Determines whether the specified character is a letter.static booleanisLetter(int codePoint)Determines whether the specified character (Unicode code point) is a letter.static booleanisLetterOrDigit(char ch)Determines whether the specified character is a letter or a digit.static booleanisLetterOrDigit(int codePoint)Determines whether the specified character (Unicode code point) is a letter or a digit.static booleanisLowerCase(char ch)Determines whether the specified character is a lowercase character.static booleanisLowerCase(int codePoint)Determines whether the specified character (Unicode code point) is a lowercase character.static booleanisLowSurrogate(char ch)determines the givencharwhether the value isUnicode low-surrogate code unit(also calledtrailing-surrogate code unit )。static booleanisMirrored(char ch)Determines whether the character is mirrored according to the Unicode specification.static booleanisMirrored(int codePoint)Determines whether the specified character (Unicode code point) is mirrored according to the Unicode specification.static booleanisSpace(char ch)deprecated.Replaced by isWhitespace(char).static booleanisSpaceChar(char ch)Determines whether the specified character is a Unicode space character.static booleanisSpaceChar(int codePoint)Determines whether the specified character (Unicode code point) is a Unicode whitespace character.static booleanisSupplementaryCodePoint(int codePoint)Determines whether the specified character (Unicode code point) is insupplementary characterwithin the range.static booleanisSurrogate(char ch)determines the givencharwhether the value is a Unicodesurrogate code unit 。static booleanisSurrogatePair(char high, char low)determines the specifiedcharwhether the value pair is validUnicode surrogate pair 。static booleanisTitleCase(char ch)Determines whether the specified character is a titlecase character.static booleanisTitleCase(int codePoint)Determines whether the specified character (Unicode code point) is a titlecase character.static booleanisUnicodeIdentifierPart(char ch)Determines whether the specified character may be part of a Unicode identifier, other than the first character.static booleanisUnicodeIdentifierPart(int codePoint)Determines whether the specified character (Unicode code point) could be part of a Unicode identifier, rather than the first character.static booleanisUnicodeIdentifierStart(char ch)Determines whether the specified character is allowed as the first character in a Unicode identifier.static booleanisUnicodeIdentifierStart(int codePoint)Determine whether the specified character (Unicode code point) is allowed as the first character in a Unicode identifier.static booleanisUpperCase(char ch)Determines whether the specified character is an uppercase character.static booleanisUpperCase(int codePoint)Determines whether the specified character (Unicode code point) is an uppercase character.static booleanisValidCodePoint(int codePoint)Determines whether the specified code point is valid.Unicode code point value 。static booleanisWhitespace(char ch)Determines whether the specified character is white space according to Java.static booleanisWhitespace(int codePoint)Determines whether the specified character (Unicode code point) is whitespace according to Java.static charlowSurrogate(int codePoint)Returns the trailing surrogate (alow surrogate code unitdescribed)surrogate pairRepresents the supplementary character (Unicode code point) specified in UTF-16 encoding.static intoffsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset)returns the given indexcharThe subarray is from the given offsetindexbycodePointOffsetcode point.static intoffsetByCodePoints(CharSequence seq, int index, int codePointOffset)Returns the index within the given char sequence that is offset from the givenindexOffsetcodePointOffsetcode point.static charreverseBytes(char ch)Returns the reverse of the specifiedcharthe value obtained from the byte order in the value.static char[]toChars(int codePoint)Converts the specified character (Unicode code point) to the representation stored incharThe UTF-16 representation in the array.static inttoChars(int codePoint, char[] dst, int dstIndex)Converts the specified character (Unicode code point) to its UTF-16 representation.static inttoCodePoint(char high, char low)Converts the specified surrogate pair to its supplementary code point value.static chartoLowerCase(char ch)Converts the character argument to lowercase using the case mapping information from the UnicodeData file.static inttoLowerCase(int codePoint)Converts the character (Unicode code point) parameter to lowercase using the case mapping information in the UnicodeData file.StringtoString()Returns a representation of thisCharacterOf the valueStringObject.static StringtoString(char c)returns a representation of the specifiedcharofStringObject.static StringtoString(int codePoint)Returns a string representing the specified character (Unicode code point)StringObject.static chartoTitleCase(char ch)Converts the character argument to titlecase using the case mapping information from the UnicodeData file.static inttoTitleCase(int codePoint)Converts the character (Unicode code point) parameter to titlecase using the case mapping information in the UnicodeData file.static chartoUpperCase(char ch)Converts the character argument to uppercase using the case mapping information from the UnicodeData file.static inttoUpperCase(int codePoint)Converts the character (Unicode code point) parameter to uppercase using the case mapping information in the UnicodeData file.static CharactervalueOf(char c)returns a representation of the specifiedcharOf the valueCharacterinstance.
-
-
-
Field Details
-
MIN_RADIX
public static final int MIN_RADIX
The minimum radix available for conversion to and from strings. The constant value of this field is the smallest value permitted for the radix argument in radix conversion methods, for example,digitmethod,forDigitmethod andtoStringClassIntegermethod.
-
MAX_RADIX
public static final int MAX_RADIX
The maximum radix available for conversion to and from strings. The constant value of this field is the one allowed by the radix parameter in the radix conversion method.digit, for exampledigitmethod,forDigitmethod andtoStringClassIntegermethod.
-
MIN_VALUE
public static final char MIN_VALUE
The constant value of this field is of typechar'\u0000'。- Starting from the following version:
- 1.0.2
- See also:
- constant field value
-
MAX_VALUE
public static final char MAX_VALUE
The constant value of this field is of typechar'\uFFFF'。- Starting from the following version:
- 1.0.2
- See also:
- constant field value
-
TYPE
public static final 类<Character> TYPE
Classthe instance represents a primitive typechar。- Starting from the following version:
- 1.1
-
UNASSIGNED
public static final byte UNASSIGNED
General category 'Cn' in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
UPPERCASE_LETTER
public static final byte UPPERCASE_LETTER
General category 'Lu' in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
LOWERCASE_LETTER
public static final byte LOWERCASE_LETTER
The general category 'Ll' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
TITLECASE_LETTER
public static final byte TITLECASE_LETTER
General category 'Lt' in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
MODIFIER_LETTER
public static final byte MODIFIER_LETTER
The general category 'Lm' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
OTHER_LETTER
public static final byte OTHER_LETTER
The general category 'Lo' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
NON_SPACING_MARK
public static final byte NON_SPACING_MARK
The general category 'Mn' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
ENCLOSING_MARK
public static final byte ENCLOSING_MARK
General category "Me" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
COMBINING_SPACING_MARK
public static final byte COMBINING_SPACING_MARK
General category "Mc" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
DECIMAL_DIGIT_NUMBER
public static final byte DECIMAL_DIGIT_NUMBER
General category "Nd" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
LETTER_NUMBER
public static final byte LETTER_NUMBER
General category "Nl" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
OTHER_NUMBER
public static final byte OTHER_NUMBER
The general category “No” in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
SPACE_SEPARATOR
public static final byte SPACE_SEPARATOR
The general category 'Zs' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
LINE_SEPARATOR
public static final byte LINE_SEPARATOR
General category "Zl" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
PARAGRAPH_SEPARATOR
public static final byte PARAGRAPH_SEPARATOR
The general category 'Zp' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
CONTROL
public static final byte CONTROL
General category "Cc" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
FORMAT
public static final byte FORMAT
General category "Cf" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
PRIVATE_USE
public static final byte PRIVATE_USE
The general category 'Co' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
SURROGATE
public static final byte SURROGATE
The general category 'Cs' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
DASH_PUNCTUATION
public static final byte DASH_PUNCTUATION
General category "Pd" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
START_PUNCTUATION
public static final byte START_PUNCTUATION
The general category 'Ps' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
END_PUNCTUATION
public static final byte END_PUNCTUATION
General category "Pe" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
CONNECTOR_PUNCTUATION
public static final byte CONNECTOR_PUNCTUATION
General category "Pc" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
OTHER_PUNCTUATION
public static final byte OTHER_PUNCTUATION
The general category 'Po' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
MATH_SYMBOL
public static final byte MATH_SYMBOL
The general category 'Sm' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
CURRENCY_SYMBOL
public static final byte CURRENCY_SYMBOL
General category "Sc" in the Unicode specification.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
MODIFIER_SYMBOL
public static final byte MODIFIER_SYMBOL
The general category 'Sk' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
OTHER_SYMBOL
public static final byte OTHER_SYMBOL
The general category 'So' in the Unicode Standard.- Starting from the following version:
- 1.1
- See also:
- constant field value
-
INITIAL_QUOTE_PUNCTUATION
public static final byte INITIAL_QUOTE_PUNCTUATION
General category "Pi" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
FINAL_QUOTE_PUNCTUATION
public static final byte FINAL_QUOTE_PUNCTUATION
General category "Pf" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_UNDEFINED
public static final byte DIRECTIONALITY_UNDEFINED
Undefined bidirectional character type. undefinedcharThe value has undefined directionality in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_LEFT_TO_RIGHT
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT
The strong bidirectional character type "L" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_RIGHT_TO_LEFT
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT
The strong bidirectional character type 'R' in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
The strong bidirectional character type "AL" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_EUROPEAN_NUMBER
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER
The weak bidirectional character type "EN" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
The weak bidirectional character type "ES" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
The weak bidirectional character type "ET" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_ARABIC_NUMBER
public static final byte DIRECTIONALITY_ARABIC_NUMBER
The weak bidirectional character type "AN" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
The weak bidirectional character type "CS" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_NONSPACING_MARK
public static final byte DIRECTIONALITY_NONSPACING_MARK
The weak bidirectional character type "NSM" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_BOUNDARY_NEUTRAL
public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL
The weak bidirectional character type "BN" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_PARAGRAPH_SEPARATOR
public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR
The neutral bidirectional character type "B" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_SEGMENT_SEPARATOR
public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR
The neutral bidirectional character type "S" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_WHITESPACE
public static final byte DIRECTIONALITY_WHITESPACE
The neutral bidirectional character type "WS" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_OTHER_NEUTRALS
public static final byte DIRECTIONALITY_OTHER_NEUTRALS
The neutral bidirectional character type "ON" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
The strong bidirectional character type 'LRE' in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
The strong bidirectional character type "LRO" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
The strong bidirectional character type "RLE" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
The strong bidirectional character type "RLO" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
The weak bidirectional character type "PDF" in the Unicode specification.- Starting from the following version:
- 1.4
- See also:
- constant field value
-
DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE
The weak bidirectional character type "LRI" in the Unicode specification.- Starting from the following version:
- 9
- See also:
- constant field value
-
DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE
The weak bidirectional character type "RLI" in the Unicode specification.- Starting from the following version:
- 9
- See also:
- constant field value
-
DIRECTIONALITY_FIRST_STRONG_ISOLATE
public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE
The weak bidirectional character type 'FSI' in the Unicode specification.- Starting from the following version:
- 9
- See also:
- constant field value
-
DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE
The weak bidirectional character type "PDI" in the Unicode specification.- Starting from the following version:
- 9
- See also:
- constant field value
-
MIN_HIGH_SURROGATE
public static final char MIN_HIGH_SURROGATE
In UTF-16 encodingUnicode high-surrogate code unitthe minimum value, constant'\uD800'。 the high surrogate is also known asleading surrogate 。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MAX_HIGH_SURROGATE
public static final char MAX_HIGH_SURROGATE
The maximum value in UTF-16 encoding isUnicode high-surrogate code unit, the constant is'\uDBFF'。 the high surrogate is also known asleading surrogate 。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MIN_LOW_SURROGATE
public static final char MIN_LOW_SURROGATE
In UTF-16 encodingUnicode low-surrogate code unitthe minimum value, constant'\uDC00'。 low surrogate is also calledtrailing surrogate 。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MAX_LOW_SURROGATE
public static final char MAX_LOW_SURROGATE
the maximum value in UTF-16 encodingUnicode low-surrogate code unit, constant'\uDFFF'。 low surrogate is also calledtrailing surrogate 。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MIN_SURROGATE
public static final char MIN_SURROGATE
The minimum value of a Unicode surrogate code unit in UTF-16 encoding, a constant.'\uD800'。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MAX_SURROGATE
public static final char MAX_SURROGATE
The maximum value of a Unicode surrogate code unit in UTF-16 encoding, a constant.'\uDFFF'。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MIN_SUPPLEMENTARY_CODE_POINT
public static final int MIN_SUPPLEMENTARY_CODE_POINT
minimum valueUnicode supplementary code point, constantU+10000。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MIN_CODE_POINT
public static final int MIN_CODE_POINT
minimum valueUnicode code point, constantU+0000。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
MAX_CODE_POINT
public static final int MAX_CODE_POINT
maximum valueUnicode code point, constantU+10FFFF。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
SIZE
public static final int SIZE
used to represent the unsigned binary form ofcharthe number of bits in the value, constant16。- Starting from the following version:
- 1.5
- See also:
- constant field value
-
BYTES
public static final int BYTES
used to represent the unsigned binary form ofcharthe number of bytes in the value.- Starting from the following version:
- 1.8
- See also:
- constant field value
-
-
Constructor Details
-
Character
@Deprecated(since="9") public Character(char value)
Deprecated.It is rarely appropriate to use this constructor. The static factoryvalueOf(char)is generally a better choice, as it is likely to yield significantly better space and time performance.constructs a newly allocatedCharacterobject that represents the specifiedcharvalue.- Parameter
-
value- to beCharacterThe value represented by the object.
-
-
Method Details
-
valueOf
public static Character valueOf(char c)
returns a representation of the specifiedcharOf the valueCharacterinstance. if a new one is not neededCharacterFor an instance, this method should generally be preferred over the constructorCharacter(char), because this method can significantly improve space and time performance by caching frequently requested values. This method will always cache'\u0000'To'\u007F'Values within the range, and other values outside this range can be cached.- Parameter
-
c- char value. - Result
-
Characterinstance, representingc。 - Starting from the following version:
- 1.5
-
charValue
public char charValue()
Return thisCharacterthe value of the object.- Result
- The primitive value represented by this object.
char。
-
hashCode
public int hashCode()
Return thisCharacterthe hash code; equivalent to callingcharValue()the result of.- Override:
-
hashCodeClassObject - Result
- this
Characterthe hash code value - See also:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
-
hashCode
public static int hashCode(char value)
returncharhash code of the value; andCharacter.hashCode()compatible.- Parameter
-
value- the object for which the hash code is to be returned.char。 - Result
-
charThe hash code value of the value. - Starting from the following version:
- 1.8
-
equals
public boolean equals(Object obj)
Compares this object with the specified object. if and only if the argument is notnulland isCharacterwhen the object, the result istrue, which represents the same as this object.charvalue.- Override:
-
equalsIn classObject - Parameter
-
obj- the object to be compared with. - Result
-
trueif the objects are the same; otherwise isfalse。 - See also:
-
Object.hashCode(),HashMap
-
toString
public String toString()
Returns a representation of thisCharacterOf the valueStringObject. The result is a string of length 1 whose only component is the originalcharby this representation valueCharacterObject.
-
toString
public static String toString(char c)
returns a representation of the specifiedcharofStringObject. The result is a string of length 1 consisting only of the specifiedchar。- API Note:
-
this method cannot handlesupplementary characters 。
To support all Unicode characters (including supplementary characters), use
toString(int)method. - Parameter
-
c- to be convertedchar - Result
- specified
charthe string representation ofchar - Starting from the following version:
- 1.4
-
toString
public static String toString(int codePoint)
Returns a string representing the specified character (Unicode code point)StringObject. The result is a string of length 1 or 2, consisting solely of the specifiedcodePoint。- Parameter
-
codePoint- to be convertedcodePoint - Result
- specified
codePointthe string representation ofcodePoint - Exception
-
IllegalArgumentException- if the specifiedcodePointis notvalid Unicode code point 。 - Starting from the following version:
- 11
-
isValidCodePoint
public static boolean isValidCodePoint(int codePoint)
Determines whether the specified code point is valid.Unicode code point value 。- Parameter
-
codePoint- The Unicode code point to be tested - Result
-
trueIf the specified code point value is betweenMIN_CODE_POINTandMAX_CODE_POINTbetween; otherwise isfalse。 - Starting from the following version:
- 1.5
-
isBmpCodePoint
public static boolean isBmpCodePoint(int codePoint)
Determines whether the specified character (Unicode code point) is inIn the Basic Multilingual Plane (BMP) 。 These code points can be represented using a singlecharRepresents.
-
isSupplementaryCodePoint
public static boolean isSupplementaryCodePoint(int codePoint)
Determines whether the specified character (Unicode code point) is insupplementary characterwithin the range.- Parameter
-
codePoint- The character (Unicode code point) to be tested - Result
-
trueIf the specified code point is betweenMIN_SUPPLEMENTARY_CODE_POINTandMAX_CODE_POINTbetween; otherwise isfalse。 - Starting from the following version:
- 1.5
-
isHighSurrogate
public static boolean isHighSurrogate(char ch)
determines the givencharwhether the value isUnicode high-surrogate code unit(also calledleading surrogate code unit )。These values do not themselves represent characters, but are used in UTF-16 encoding to representsupplementary characters 。
- Parameter
-
ch- to be testedcharvalue. - Result
-
trueifcharvalue betweenMIN_HIGH_SURROGATEandMAX_HIGH_SURROGATEbetween; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isLowSurrogate(char),Character.UnicodeBlock.of(int)
-
isLowSurrogate
public static boolean isLowSurrogate(char ch)
determines the givencharwhether the value isUnicode low-surrogate code unit(also calledtrailing-surrogate code unit )。These values themselves do not represent characters, but in UTF-16 encoding are expressed assupplementary charactersits representation is used.
- Parameter
-
ch- the value to be testedchar。 - Result
-
trueifcharvalue betweenMIN_LOW_SURROGATEandMAX_LOW_SURROGATEbetween; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isHighSurrogate(char)
-
isSurrogate
public static boolean isSurrogate(char ch)
determines the givencharwhether the value is a Unicodesurrogate code unit 。These values do not themselves represent characters, but are used in UTF-16 encoding to representsupplementary characters 。
A char value is a surrogate code unit if and only if it islow-surrogate code unitorwhen a high-surrogate code unit 。
- Parameter
-
ch- to be testedcharvalue. - Result
-
trueifcharvalue betweenMIN_SURROGATEandMAX_SURROGATEbetween; otherwise isfalse。 - Starting from the following version:
- 1.7
-
isSurrogatePair
public static boolean isSurrogatePair(char high, char low)determines the specifiedcharwhether the value pair is validUnicode surrogate pair 。This method is equivalent to the expression:
isHighSurrogate(high) && isLowSurrogate(low)- Parameter
-
high- the high surrogate code value to be tested -
low- the low surrogate code value to be tested - Result
-
trueIf the specified high surrogate value and low surrogate code value represent a valid surrogate pair; otherwise isfalse。 - Starting from the following version:
- 1.5
-
charCount
public static int charCount(int codePoint)
Determines what is required to represent the specified character (Unicode code point)charthe number of values. If the specified character is greater than or equal to 0x10000, the method returns 2. Otherwise, the method returns 1.This method does not validate the specified character as a valid Unicode code point. If necessary, the caller must use
isValidCodePointVerifies the character value.- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
- 2 if the character is a valid supplementary character; otherwise, it is 1.
- Starting from the following version:
- 1.5
- See also:
-
isSupplementaryCodePoint(int)
-
toCodePoint
public static int toCodePoint(char high, char low)Converts the specified surrogate pair to its supplementary code point value. This method does not validate the specified surrogate pair. If necessary, the caller must useisSurrogatePairvalidate it.- Parameter
-
high- the high surrogate code unit -
low- the low surrogate code unit - Result
- The supplementary code point composed of the specified surrogate pair.
- Starting from the following version:
- 1.5
-
codePointAt
public static int codePointAt(CharSequence seq, int index)
returnCharSequencethe code point at the given index. ifcharthe value at the given indexCharSequenceIn the high-surrogate range, the following index is less than the stated length.CharSequence, andcharIf the value at the following index is in the low surrogate range, then the auxiliary returns the code point corresponding to this surrogate pair. Otherwise, return the one at the given indexcharvalue.- Parameter
-
seq- a series ofcharvalue (Unicode code unit) -
index- to be convertedcharThe value (Unicode code unit) ofseq - Result
- The Unicode code point at the given index
- Exception
-
NullPointerException- ifseqis empty. -
IndexOutOfBoundsException- if the valueindexis negative or not less thanseq.length()。 - Starting from the following version:
- 1.5
-
codePointAt
public static int codePointAt(char[] a, int index)returncharthe code point at the given index of the array. ifcharat the given index in the arraycharIf the value is in the high-surrogate range, the following index is less thancharThe length of the array, and at the following indexcharIf the value is in the low surrogate range, then the supplementary code point corresponding to the surrogate pair is returned. Otherwise, return the one at the given indexcharvalue.- Parameter
-
a- arraychar -
index- to be convertedcharin the arraycharThe value (Unicode code unit) ofchar - Result
- The Unicode code point at the given index
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- if the valueindexis negative or not less thancharthe length of the array. - Starting from the following version:
- 1.5
-
codePointAt
public static int codePointAt(char[] a, int index, int limit)returncharThe code point at the given index of the array, where only ... can be usedindexless thanlimitarray elements. ifcharat the given index in the arraycharIf the value is in the high-surrogate range, the following index is less thanlimit, and at the following indexcharIf the value is in the low-surrogate range, then the supplementary code point corresponding to this surrogate pair is returned. Otherwise, return the one at the given indexcharvalue.- Parameter
-
a-chararray -
index- to be convertedcharin the arraycharThe value (Unicode code unit) ofchar -
limit- may becharThe index after the last array element used in the array - Result
- The Unicode code point at the given index
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- ifindexIf the argument is negative or not less thanlimitthe argument, orlimitThe parameter is negative or greater thancharthe length of the array. - Starting from the following version:
- 1.5
-
codePointBefore
public static int codePointBefore(CharSequence seq, int index)
returnCharSequencethe code point before the given index. ifcharAt value(index - 1)InCharSequenceis in the low surrogate range,(index - 2)is not negative, andcharAt value(index - 2)InCharSequenceIf it is within the high surrogate range, then the supplementary code point corresponding to the surrogate pair is returned. otherwise, returnscharValue(index - 1)。- Parameter
-
seq-CharSequenceExample -
index- the index after the code point that should be returned - Result
- The Unicode code point value preceding the given index.
- Exception
-
NullPointerException- ifseqis empty. -
IndexOutOfBoundsException- ifindexIf the argument is less than 1 or greater thanseq.length()。 - Starting from the following version:
- 1.5
-
codePointBefore
public static int codePointBefore(char[] a, int index)returncharThe code point before the given index in the array. ifcharAt value(index - 1)MediumcharThe array is in the low-surrogate range,(index - 2)is not negative, andcharAt value(index - 2)MediumcharIf the array value is in the high surrogate range, then the supplementary code point corresponding to that surrogate pair is returned. otherwise, returnscharValue(index - 1)。- Parameter
-
a-chararray -
index- the index after the code point that should be returned - Result
- The Unicode code point value preceding the given index.
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- ifindexIf the argument is less than 1 or greater thancharthe length of the array - Starting from the following version:
- 1.5
-
codePointBefore
public static int codePointBefore(char[] a, int index, int start)returncharThe code point before the given index in the array, where only can be usedindexgreater than or equal tostartarray elements. ifcharAt value(index - 1)MediumcharThe array is in the low-surrogate range,(index - 2)not less thanstart, andcharAt value(index - 2)MediumcharIf the array is in the high surrogate range, then the surrogate pair corresponding to the supplementary code point is returned. otherwise, returnscharValue(index - 1)。- Parameter
-
a-chararray -
index- the index after the code point that should be returned -
start-charof the first array element in the arraychar - Result
- The Unicode code point value preceding the given index.
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- ifindexthe argument is not greater thanstartthe argument or greater thancharthe length of the array, orstartIf the argument is negative or not less thancharthe length of the array. - Starting from the following version:
- 1.5
-
highSurrogate
public static char highSurrogate(int codePoint)
Returns the leading surrogate (ahigh surrogate code unitdescribed)surrogate pairRepresents the supplementary character (Unicode code point) specified in UTF-16 encoding. If the specified character is notsupplementary character, then an unspecified value is returned.char。if
isSupplementaryCodePoint(x)Yestrue, thenisHighSurrogate(highSurrogate(x))andtoCodePoint(highSurrogate(x),lowSurrogate(x)) == xalso alwaystrue。- Parameter
-
codePoint- The supplementary character (Unicode code point) - Result
- The leading surrogate code unit used to represent a character in UTF-16 encoding
- Starting from the following version:
- 1.7
-
lowSurrogate
public static char lowSurrogate(int codePoint)
Returns the trailing surrogate (alow surrogate code unitdescribed)surrogate pairRepresents the supplementary character (Unicode code point) specified in UTF-16 encoding. If the specified character is notsupplementary character, then an unspecified value is returned.char。if
isSupplementaryCodePoint(x)Yestrue, thenisLowSurrogate(lowSurrogate(x))andtoCodePoint(highSurrogate(x), lowSurrogate(x)) == xalso alwaystrue。- Parameter
-
codePoint- The supplementary character (Unicode code point) - Result
- The trailing surrogate code unit used to represent a character in UTF-16 encoding
- Starting from the following version:
- 1.7
-
toChars
public static int toChars(int codePoint, char[] dst, int dstIndex)Converts the specified character (Unicode code point) to its UTF-16 representation. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, then the same value is stored indst[dstIndex], and returns 1. If the specified code point is a supplementary character, its surrogate value is stored indst[dstIndex](high-surrogate) anddst[dstIndex+1]in the low-surrogate, and returns 2.- Parameter
-
codePoint- The character (Unicode code point) to be converted. -
dst- of the arraychar, wherecodePointthe UTF-16 value is stored. -
dstIndex- the array in which the converted value is storeddstthe starting index of the array. - Result
- 1 if the code point is a BMP code point; 2 if the code point is a supplementary code point.
- Exception
-
IllegalArgumentException- if the specifiedcodePointNot a valid Unicode code point. -
NullPointerException- if the specifieddstis empty. -
IndexOutOfBoundsException- ifdstIndexis negative or not less thandst.length, or ifdstIndstIndexThere are not enough array elements to store the generatedcharvalue. (ifdstIndexequalsdst.length-1and specifiedcodePointis a supplementary character, the high surrogate value is not stored indst[dstIndex]。) - Starting from the following version:
- 1.5
-
toChars
public static char[] toChars(int codePoint)
Converts the specified character (Unicode code point) to the representation stored incharThe UTF-16 representation in the array. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, then the generatedcharthe array has withcodePointthe same value. If the specified code point is a supplementary code point, the resultingcharthe array has the corresponding surrogate pair.- Parameter
-
codePoint- Unicode code point - Result
- Has
codePointthe UTF-16 representation ofchararray. - Exception
-
IllegalArgumentException- if the specifiedcodePointNot a valid Unicode code point. - Starting from the following version:
- 1.5
-
codePointCount
public static int codePointCount(CharSequence seq, int beginIndex, int endIndex)
Returns the number of Unicode code points in the text range of the specified char sequence. The text range starts at the specifiedbeginIndex, and extends tocharat indexendIndex - 1。 Therefore, the length of the text range (incharin s) isendIndex-beginIndex。 Unpaired surrogates within the text range are counted as one code point each.- Parameter
-
seq- character sequence -
beginIndex- the first of the text rangecharthe index of. -
endIndex- the last of the text rangecharThe index after. - Result
- The number of Unicode code points in the specified text range
- Exception
-
NullPointerException- ifseqis empty. -
IndexOutOfBoundsException- ifbeginIndexis negative, orendIndexgreater than the length of the given sequence, orbeginIndexgreater thanendIndex。 - Starting from the following version:
- 1.5
-
codePointCount
public static int codePointCount(char[] a, int offset, int count)returncharThe number of Unicode code points in the subarray of the array argument.offsetThe parameter is the first of the subarraycharthe index,countparameter specifiescharscharThe length of the array. Unpaired surrogates in the subarray are counted as one code point each.- Parameter
-
a-chararray -
offset- givencharthe first in the arraycharthe index of -
count-charThe length of the array - Result
- The number of Unicode code points in the specified subarray
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- ifoffsetorcountis negative, oroffset + countgreater than the length of the given array. - Starting from the following version:
- 1.5
-
offsetByCodePoints
public static int offsetByCodePoints(CharSequence seq, int index, int codePointOffset)
Returns the index within the given char sequence that is offset from the givenindexOffsetcodePointOffsetcode point.indexandcodePointOffsetUnpaired surrogates in the given text range count as one code point each.- Parameter
-
seq- character sequence -
index- the index to be offset -
codePointOffset- the offset in code points - Result
- the index in the char sequence
- Exception
-
NullPointerException- ifseqis empty. -
IndexOutOfBoundsException- ifindexis negative or greater than the length of the char sequence, or ifcodePointOffsetis positive and fromindexthe substring startingindexLess thancodePointOffseta code point, or ifcodePointOffsetis negative andindexthe substring beforeindexless than the absolute valuecodePointOffsetcode point. - Starting from the following version:
- 1.5
-
offsetByCodePoints
public static int offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset)returns the given indexcharThe subarray is from the given offsetindexbycodePointOffsetcode point.startandcountparameter specifiescharsubarray of the array. byindexandcodePointOffsetUnpaired surrogates in the given text range count as one code point each.- Parameter
-
a-chararray -
start- the first of the subarraycharthe index of -
count-charThe length of the array -
index- the index to be offset -
codePointOffset- the offset in code points - Result
- index in the subarray
- Exception
-
NullPointerException- ifais empty. -
IndexOutOfBoundsException- ifstartorcountis negative, or ifstart + countgreater than the length of the given array, orindexless thanstartor greater, thenstart + count, orcodePointOffsetis positive and the text range ends withindexAnd withstart + count - 1Ends with less thancodePointOffseta code point, or ifcodePointOffsetis negative and the text range startsstart, when ending, useindex - 1has a smaller absolute value thancodePointOffsetcode point. - Starting from the following version:
- 1.5
-
isLowerCase
public static boolean isLowerCase(char ch)
Determines whether the specified character is a lowercase character.if
Character.getType(ch)The supplied general category type isLOWERCASE_LETTER, or if it has the contributory property Other_Lowercase as defined by the Unicode standard, then the character is lowercase.The following are examples of lowercase characters:
a b c d e f g h i j k l m n o p q r s t u v w x y z '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
Many other Unicode characters are also lowercase.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isLowerCase(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is lowercase; otherwise isfalse。 - See also:
-
isLowerCase(char),isTitleCase(char),toLowerCase(char),getType(char)
-
isLowerCase
public static boolean isLowerCase(int codePoint)
Determines whether the specified character (Unicode code point) is a lowercase character.If the character's general category type (as determined by
getType(codePoint)provided) asLOWERCASE_LETTER, or if it has the contributory property Other_Lowercase as defined by the Unicode standard, then the character is lowercase.The following are examples of lowercase characters:
a b c d e f g h i j k l m n o p q r s t u v w x y z '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6' '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE' '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6' '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
Many other Unicode characters are also lowercase.
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is lowercase; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isLowerCase(int),isTitleCase(int),toLowerCase(int),getType(int)
-
isUpperCase
public static boolean isUpperCase(char ch)
Determines whether the specified character is an uppercase character.A character is uppercase if its general category type, as provided by
Character.getType(ch), isUPPERCASE_LETTER。 or it has the contributory property Other_Uppercase as defined by the Unicode Standard.The following are examples of uppercase characters:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
Many other Unicode characters are also uppercase.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isUpperCase(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is uppercase; otherwise isfalse。 - Starting from the following version:
- 1.0
- See also:
-
isLowerCase(char),isTitleCase(char),toUpperCase(char),getType(char)
-
isUpperCase
public static boolean isUpperCase(int codePoint)
Determines whether the specified character (Unicode code point) is an uppercase character.If the character's general category type (determined by
getType(codePoint)provided) asUPPERCASE_LETTER, or if it has the contributory property Other_Uppercase as defined by the Unicode standard, then the character is uppercase.The following are examples of uppercase characters:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
Many other Unicode characters are also uppercase.
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is uppercase; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isLowerCase(int),isTitleCase(int),toUpperCase(int),getType(int)
-
isTitleCase
public static boolean isTitleCase(char ch)
Determines whether the specified character is a titlecase character.Whether the character is a titlecase character, if its general category type, by providing
Character.getType(ch), isTITLECASE_LETTER。Some characters look like a pair of Latin letters. For example, there is an uppercase letter that looks like “LJ” and a corresponding lowercase letter that looks like “lj”. The third form, which looks like 'Lj', is the appropriate form to use when rendering words in lowercase with an initial capital, such as in book titles.
These are returned by this method
trueSome Unicode characters:-
LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON -
LATIN CAPITAL LETTER L WITH SMALL LETTER J -
LATIN CAPITAL LETTER N WITH SMALL LETTER J -
LATIN CAPITAL LETTER D WITH SMALL LETTER Z
Many other Unicode characters are also titlecase.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isTitleCase(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a titlecase letter; otherwise isfalse。 - Starting from the following version:
- 1.0.2
- See also:
-
isLowerCase(char),isUpperCase(char),toTitleCase(char),getType(char)
-
-
isTitleCase
public static boolean isTitleCase(int codePoint)
Determines whether the specified character (Unicode code point) is a titlecase character.Whether the character is a titlecase character, if its general category type, by providing
getType(codePoint), isTITLECASE_LETTER。Some characters look like a pair of Latin letters. For example, there is an uppercase letter that looks like “LJ” and a corresponding lowercase letter that looks like “lj”. The third form, which looks like 'Lj', is the appropriate form to use when rendering words in lowercase with an initial capital, such as in book titles.
These are returned by this method
trueSome Unicode characters:-
LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON -
LATIN CAPITAL LETTER L WITH SMALL LETTER J -
LATIN CAPITAL LETTER N WITH SMALL LETTER J -
LATIN CAPITAL LETTER D WITH SMALL LETTER Z
Many other Unicode characters are also titlecase.
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a titlecase letter; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isLowerCase(int),isUpperCase(int),toTitleCase(int),getType(int)
-
-
isDigit
public static boolean isDigit(char ch)
Determines whether the specified character is a digit.A character is a digit if its general category type, as provided by
Character.getType(ch), isDECIMAL_DIGIT_NUMBER。Some Unicode character ranges containing digits:
-
'\u0030'to'\u0039', ISO-LATIN-1 digits ('0'to'9') -
'\u0660'to'\u0669', Arabic-Indic digits -
'\u06F0'to'\u06F9', extended Arabic-Indic digits -
'\u0966'to'\u096F', Devanagari numerals -
'\uFF10'To'\uFF19','\uFF19'Numbers
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isDigit(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a digit; otherwise isfalse。 - See also:
-
digit(char, int),forDigit(int, int),getType(char)
-
-
isDigit
public static boolean isDigit(int codePoint)
Determines whether the specified character (Unicode code point) is a digit.A character is a digit if its general category type, as provided by
getType(codePoint), isDECIMAL_DIGIT_NUMBER。Some Unicode character ranges containing digits:
-
'\u0030'to'\u0039', ISO-LATIN-1 digits ('0'to'9') -
'\u0660'to'\u0669', Arabic-Indic digits -
'\u06F0'to'\u06F9', extended Arabic-Indic digits -
'\u0966'to'\u096F', Devanagari numerals -
'\uFF10'to'\uFF19', full-width digits
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a digit; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
forDigit(int, int),getType(int)
-
-
isDefined
public static boolean isDefined(char ch)
Determines whether the character is defined in Unicode.A character is defined if at least one of the following conditions is satisfied:
- It has an entry in the UnicodeData file.
- It has a value in the range defined by the UnicodeData file.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isDefined(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character has a defined meaning in Unicode; otherwise isfalse。 - Starting from the following version:
- 1.0.2
- See also:
-
isDigit(char),isLetter(char),isLetterOrDigit(char),isLowerCase(char),isTitleCase(char),isUpperCase(char)
-
isDefined
public static boolean isDefined(int codePoint)
Determines whether the character (Unicode code point) is defined in Unicode.A character is defined if at least one of the following conditions is satisfied:
- It has an entry in the UnicodeData file.
- It has a value in the range defined by the UnicodeData file.
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character has a defined meaning in Unicode; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isDigit(int),isLetter(int),isLetterOrDigit(int),isLowerCase(int),isTitleCase(int),isUpperCase(int)
-
isLetter
public static boolean isLetter(char ch)
Determines whether the specified character is a letter.If the character's general category type (determined by
Character.getType(ch)provided) is any one of the following characters, then the character is considered a letter:-
UPPERCASE_LETTER -
LOWERCASE_LETTER -
TITLECASE_LETTER -
MODIFIER_LETTER -
OTHER_LETTER
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isLetter(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a letter;falseotherwise. - See also:
-
isDigit(char),isJavaIdentifierStart(char),isJavaLetter(char),isJavaLetterOrDigit(char),isLetterOrDigit(char),isLowerCase(char),isTitleCase(char),isUnicodeIdentifierStart(char),isUpperCase(char)
-
-
isLetter
public static boolean isLetter(int codePoint)
Determines whether the specified character (Unicode code point) is a letter.If the character's general category type (determined by
getType(codePoint)provided) is any one of the following characters, then the character is considered a letter:-
UPPERCASE_LETTER -
LOWERCASE_LETTER -
TITLECASE_LETTER -
MODIFIER_LETTER -
OTHER_LETTER
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a letter; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isDigit(int),isJavaIdentifierStart(int),isLetterOrDigit(int),isLowerCase(int),isTitleCase(int),isUnicodeIdentifierStart(int),isUpperCase(int)
-
-
isLetterOrDigit
public static boolean isLetterOrDigit(char ch)
Determines whether the specified character is a letter or a digit.A character is considered if it is any letter or digit.
Character.isLetter(char ch)orCharacter.isDigit(char ch)Returntruethe character of.Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isLetterOrDigit(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a letter or digit; otherwise isfalse。 - Starting from the following version:
- 1.0.2
- See also:
-
isDigit(char),isJavaIdentifierPart(char),isJavaLetter(char),isJavaLetterOrDigit(char),isLetter(char),isUnicodeIdentifierPart(char)
-
isLetterOrDigit
public static boolean isLetterOrDigit(int codePoint)
Determines whether the specified character (Unicode code point) is a letter or a digit.A character is considered if it is any letter or digit.
isLetter(codePoint)itemsorisDigit(codePoint)Returntruethe character of.- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a letter or digit; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isDigit(int),isJavaIdentifierPart(int),isLetter(int),isUnicodeIdentifierPart(int)
-
isJavaLetter
@Deprecated(since="1.1") public static boolean isJavaLetter(char ch)
Deprecated.Replaced by isJavaIdentifierStart(char).Determines whether the specified character is allowed as the first character in a Java identifier.A character may start a Java identifier if and only if one of the following conditions is true:
-
isLetter(ch)returntrue -
getType(ch)returnLETTER_NUMBER -
chis a currency symbol (e.g.,'$') -
chis a connector punctuation character (e.g.'_')。
- Parameter
-
ch- the character to be tested. - Result
-
trueif the character can start a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.0.2
- See also:
-
isJavaLetterOrDigit(char),isJavaIdentifierStart(char),isJavaIdentifierPart(char),isLetter(char),isLetterOrDigit(char),isUnicodeIdentifierStart(char)
-
-
isJavaLetterOrDigit
@Deprecated(since="1.1") public static boolean isJavaLetterOrDigit(char ch)
Deprecated.Replaced by isJavaIdentifierPart(char).Determines whether the specified character may be part of a Java identifier as other than the first character.A character may be part of a Java identifier if and only if any of the following conditions is satisfied:
- This is a letter
- It is a currency symbol (e.g.
'$') - it is a connector punctuation character (such as
'_') - This is a number
- It is a numeric letter (for example, Roman numeral characters)
- It is a combining mark
- It is a non-spacing mark
-
isIdentifierIgnorablereturns for that charactertrue。
- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character may be part of a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.0.2
- See also:
-
isJavaLetter(char),isJavaIdentifierStart(char),isJavaIdentifierPart(char),isLetter(char),isLetterOrDigit(char),isUnicodeIdentifierPart(char),isIdentifierIgnorable(char)
-
isAlphabetic
public static boolean isAlphabetic(int codePoint)
Determines whether the specified character (Unicode code point) is a letter.If the character's general category type (determined by
getType(codePoint)If the provided character is any of the following, that character is considered a letter character:-
UPPERCASE_LETTER -
LOWERCASE_LETTER -
TITLECASE_LETTER -
MODIFIER_LETTER -
OTHER_LETTER -
LETTER_NUMBER
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a Unicode letter character,false。 - Starting from the following version:
- 1.7
-
-
isIdeographic
public static boolean isIdeographic(int codePoint)
Determines whether the specified character (Unicode code point) is a CJKV (Chinese, Japanese, Korean, and Vietnamese) ideograph as defined by the Unicode Standard.- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a Unicode ideographic character,false。 - Starting from the following version:
- 1.7
-
isJavaIdentifierStart
public static boolean isJavaIdentifierStart(char ch)
Determines whether the specified character is allowed as the first character in a Java identifier.A character may start a Java identifier if and only if one of the following conditions is true:
-
isLetter(ch)returntrue -
getType(ch)returnLETTER_NUMBER -
chis a currency symbol (e.g.,'$') -
chis a connector punctuation character (e.g.'_')。
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isJavaIdentifierStart(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueif the character can start a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isJavaIdentifierPart(char),isLetter(char),isUnicodeIdentifierStart(char),SourceVersion.isIdentifier(CharSequence)
-
-
isJavaIdentifierStart
public static boolean isJavaIdentifierStart(int codePoint)
Determine whether a character (Unicode code point) is allowed as the first character in a Java identifier.A character may start a Java identifier if and only if one of the following conditions is true:
-
isLetter(codePoint)returntrue -
getType(codePoint)returnLETTER_NUMBER - The referenced character is a currency symbol (e.g.
'$') - The referenced character is a connector punctuation character (for example
'_')。
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueif the character can start a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isJavaIdentifierPart(int),isLetter(int),isUnicodeIdentifierStart(int),SourceVersion.isIdentifier(CharSequence)
-
-
isJavaIdentifierPart
public static boolean isJavaIdentifierPart(char ch)
Determines whether the specified character may be part of a Java identifier as other than the first character.A character may be part of a Java identifier if any of the following conditions are true:
- This is a letter
- It is a currency symbol (e.g.
'$') - it is a connector punctuation character (such as
'_') - This is a number
- It is a numeric letter (for example, Roman numeral characters)
- It is a combining mark
- It is a non-spacing mark
-
isIdentifierIgnorableReturntruecharacters of
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isJavaIdentifierPart(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character may be part of a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isIdentifierIgnorable(char),isJavaIdentifierStart(char),isLetterOrDigit(char),isUnicodeIdentifierPart(char),SourceVersion.isIdentifier(CharSequence)
-
isJavaIdentifierPart
public static boolean isJavaIdentifierPart(int codePoint)
Determines whether a character (Unicode code point) is likely to be part of a Java identifier, but not the first character.A character may be part of a Java identifier if any of the following conditions are true:
- This is a letter
- It is a currency symbol (e.g.
'$') - it is a connector punctuation character (such as
'_') - This is a number
- It is a numeric letter (for example, Roman numeral characters)
- It is a combining mark
- It is a non-spacing mark
-
isIdentifierIgnorable(codePoint)itemsReturntruecharacters of
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character may be part of a Java identifier; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isIdentifierIgnorable(int),isJavaIdentifierStart(int),isLetterOrDigit(int),isUnicodeIdentifierPart(int),SourceVersion.isIdentifier(CharSequence)
-
isUnicodeIdentifierStart
public static boolean isUnicodeIdentifierStart(char ch)
Determines whether the specified character is allowed as the first character in a Unicode identifier.A character can start a Unicode identifier if and only if one of the following conditions is met.
-
isLetter(ch)returntrue -
getType(ch)returnLETTER_NUMBER。
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isUnicodeIdentifierStart(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character may start a Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isJavaIdentifierStart(char),isLetter(char),isUnicodeIdentifierPart(char)
-
-
isUnicodeIdentifierStart
public static boolean isUnicodeIdentifierStart(int codePoint)
Determine whether the specified character (Unicode code point) is allowed as the first character in a Unicode identifier.A character can start a Unicode identifier if and only if one of the following conditions is met.
-
isLetter(codePoint)returntrue -
getType(codePoint)returnLETTER_NUMBER。
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character may start a Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isJavaIdentifierStart(int),isLetter(int),isUnicodeIdentifierPart(int)
-
-
isUnicodeIdentifierPart
public static boolean isUnicodeIdentifierPart(char ch)
Determines whether the specified character may be part of a Unicode identifier, other than the first character.A character may be part of a Unicode identifier if and only if one of the following statements is true:
- This is a letter
- it is a connector punctuation character (such as
'_') - This is a number
- It is a numeric letter (for example, Roman numeral characters)
- It is a combining mark
- It is a non-spacing mark
-
isIdentifierIgnorablereturntrueThis character.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isUnicodeIdentifierPart(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character may be part of a Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isIdentifierIgnorable(char),isJavaIdentifierPart(char),isLetterOrDigit(char),isUnicodeIdentifierStart(char)
-
isUnicodeIdentifierPart
public static boolean isUnicodeIdentifierPart(int codePoint)
Determines whether the specified character (Unicode code point) could be part of a Unicode identifier, rather than the first character.A character may be part of a Unicode identifier if and only if one of the following statements is true:
- This is a letter
- it is a connector punctuation character (such as
'_') - This is a number
- It is a numeric letter (for example, Roman numeral characters)
- It is a combining mark
- It is a non-spacing mark
-
isIdentifierIgnorablereturns for this charactertrue。
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character may be part of a Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isIdentifierIgnorable(int),isJavaIdentifierPart(int),isLetterOrDigit(int),isUnicodeIdentifierStart(int)
-
isIdentifierIgnorable
public static boolean isIdentifierIgnorable(char ch)
Determines whether the specified character should be regarded as an ignorable character in a Java identifier or a Unicode identifier.The following Unicode characters can be ignored in Java identifiers or Unicode identifiers:
- ISO control characters are not spaces
-
'\u0000'To'\u0008' -
'\u000E'To'\u001B' -
'\u007F'To'\u009F'
-
- Has
FORMATall characters with the general category value
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isIdentifierIgnorable(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueif the character is an ignorable control character, it may be part of a Java or Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isJavaIdentifierPart(char),isUnicodeIdentifierPart(char)
- ISO control characters are not spaces
-
isIdentifierIgnorable
public static boolean isIdentifierIgnorable(int codePoint)
Determines whether the specified character (Unicode code point) should be considered an ignorable character in a Java identifier or a Unicode identifier.The following Unicode characters can be ignored in Java identifiers or Unicode identifiers:
- ISO control characters are not spaces
-
'\u0000'To'\u0008' -
'\u000E'To'\u001B' -
'\u007F'To'\u009F'
-
- Has
FORMATall characters with the general category value
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueif the character is an ignorable control character, it may be part of a Java or Unicode identifier; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isJavaIdentifierPart(int),isUnicodeIdentifierPart(int)
- ISO control characters are not spaces
-
toLowerCase
public static char toLowerCase(char ch)
Converts the character argument to lowercase using the case mapping information from the UnicodeData file.Please note that for certain character ranges,
Character.isLowerCase(Character.toLowerCase(ch))does not always returntrue, especially those symbols or ideographic symbols.In general, you should use
String.toLowerCase()Maps the character to lowercase.Stringthan the case mapping methodCharacterThe case mapping methods have several benefits.StringThe case mapping method can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whileCharacterThe case mapping method, however, cannot.Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
toLowerCase(int)method.- Parameter
-
ch- the character to be converted. - Result
- The lowercase equivalent of the character, if any; Otherwise, the character itself.
- See also:
-
isLowerCase(char),String.toLowerCase()
-
toLowerCase
public static int toLowerCase(int codePoint)
Converts the character (Unicode code point) parameter to lowercase using the case mapping information in the UnicodeData file.Please note that for certain character ranges,
Character.isLowerCase(Character.toLowerCase(codePoint))does not always returntrue, especially those symbols or ideographic symbols.In general, you should use
String.toLowerCase()Maps the character to lowercase.Stringthan the case mapping methodCharacterThe case mapping methods have several benefits.StringThe case mapping method can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whileCharacterThe case mapping method, however, cannot.- Parameter
-
codePoint- The character (Unicode code point) to be converted. - Result
- The lowercase equivalent of the character (Unicode code point), if any; Otherwise, the character itself.
- Starting from the following version:
- 1.5
- See also:
-
isLowerCase(int),String.toLowerCase()
-
toUpperCase
public static char toUpperCase(char ch)
Converts the character argument to uppercase using the case mapping information from the UnicodeData file.Please note that for certain character ranges,
Character.isUpperCase(Character.toUpperCase(ch))does not always returntrue, especially those symbols or ideographic symbols.In general, you should use
String.toUpperCase()Maps the character to uppercase.Stringthan the case mapping methodCharacterThe case mapping methods have several benefits.StringThe case mapping method can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whileCharacterThe case mapping method, however, cannot.Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
toUpperCase(int)method.- Parameter
-
ch- the character to be converted. - Result
- The uppercase equivalent of the character, if any; Otherwise, the character itself.
- See also:
-
isUpperCase(char),String.toUpperCase()
-
toUpperCase
public static int toUpperCase(int codePoint)
Converts the character (Unicode code point) parameter to uppercase using the case mapping information in the UnicodeData file.Please note that for certain character ranges,
Character.isUpperCase(Character.toUpperCase(codePoint))does not always returntrue, especially those symbols or ideographic symbols.In general, you should use
String.toUpperCase()Maps the character to uppercase.Stringthan the case mapping methodCharacterThe case mapping methods have several benefits.StringThe case mapping method can perform locale-sensitive mappings, context-sensitive mappings, and 1:M character mappings, whileCharacterThe case mapping method, however, cannot.- Parameter
-
codePoint- The character (Unicode code point) to be converted. - Result
- The uppercase equivalent of the character, if any; Otherwise, the character itself.
- Starting from the following version:
- 1.5
- See also:
-
isUpperCase(int),String.toUpperCase()
-
toTitleCase
public static char toTitleCase(char ch)
Converts the character argument to titlecase using the case mapping information from the UnicodeData file. If a character has no explicit titlecase mapping, and is not itself a titlecase string according to UnicodeData, then the uppercase mapping is returned as the equivalent titlecase mapping. ifcharThe parameter is already the titlechar, then the same will be returnedcharvalue.Please note that for certain character ranges,
Character.isTitleCase(Character.toTitleCase(ch))does not always returntrue。Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
toTitleCase(int)method.- Parameter
-
ch- the character to be converted. - Result
- equivalent to the titlecase of that character, if any; Otherwise, the character itself.
- Starting from the following version:
- 1.0.2
- See also:
-
isTitleCase(char),toLowerCase(char),toUpperCase(char)
-
toTitleCase
public static int toTitleCase(int codePoint)
Converts the character (Unicode code point) parameter to titlecase using the case mapping information in the UnicodeData file. If a character has no explicit titlecase mapping, and is not itself a titlecase string according to UnicodeData, then the uppercase mapping is returned as the equivalent titlecase mapping. If the character argument is already a titlecase character, the same character value is returned.Please note that for certain character ranges,
Character.isTitleCase(Character.toTitleCase(codePoint))does not always returntrue。- Parameter
-
codePoint- The character (Unicode code point) to be converted. - Result
- equivalent to the titlecase of that character, if any; Otherwise, the character itself.
- Starting from the following version:
- 1.5
- See also:
-
isTitleCase(int),toLowerCase(int),toUpperCase(int)
-
digit
public static int digit(char ch, int radix)Returns the character in the specified radixchof the numeric value.If the radix is not in range
MIN_RADIX≤radix≤MAX_RADIXor valuechNot a valid digit for the specified base,-1returns. If at least one of the following conditions is met, the character is a valid digit:- Methods
isDigitis a charactertrue, and the Unicode decimal value of the character (or its single-character decomposition) is less than the specified radix. In this case, returns the decimal numeric value. - The character is an uppercase Latin letter.
'A'To'Z', whose code is less thanradix + 'A' - 10。 In this case, returnsch - 'A' + 10。 - The character is a lowercase Latin letter.
'a'to'z', whose code is less thanradix + 'a' - 10。 In this case, returnsch - 'a' + 10。 - This character is full
'\uFF21'Write Latin letter A ('\uFF21') to Z ('\uFF3A') one whose code is less thanradix + '\uFF21' - 10。 In this case, returnsch - '\uFF21' + 10。 - The character is the full-width lowercase Latin letter a (
'\uFF41') to z ('\uFF5A') one whose code is less thanradix + '\uFF41' - 10。 In this case, returnsch - '\uFF41' + 10。
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
digit(int, int)method.- Parameter
-
ch- the character to be converted. -
radix- radix. - Result
- The numeric value that the character represents in the specified radix.
- See also:
-
forDigit(int, int),isDigit(char)
- Methods
-
digit
public static int digit(int codePoint, int radix)Returns the numeric value of the specified character (Unicode code point) in the specified radix.If the radix is not in range
MIN_RADIX≤radix≤MAX_RADIX, or if the character is not a valid digit in the specified radix,-1returns. If at least one of the following conditions is met, the character is a valid digit:- Methods
isDigit(codePoint)is a charactertrue, and the Unicode decimal value of the character (or its single-character decomposition) is less than the specified radix. In this case, returns the decimal numeric value. - The character is an uppercase Latin letter.
'A'To'Z', whose code is less thanradix + 'A' - 10。 In this case, returnscodePoint - 'A' + 10。 - The character is a lowercase Latin letter.
'a'To'z', whose code is less thanradix + 'a' - 10。 In this case, returnscodePoint - 'a' + 10。 - This character is full
'\uFF21'Write Latin letter A ('\uFF21') to Z ('\uFF3A') one whose code is less thanradix + '\uFF21' - 10。 In this case, returnscodePoint - '\uFF21' + 10。 - The character is the full-width lowercase Latin letter a (
'\uFF41') to z ('\uFF5A') one whose code is less thanradix + '\uFF41'- 10。 In this case, returnscodePoint - '\uFF41' + 10。
- Parameter
-
codePoint- The character (Unicode code point) to be converted. -
radix- radix. - Result
- The numeric value that the character represents in the specified radix.
- Starting from the following version:
- 1.5
- See also:
-
forDigit(int, int),isDigit(int)
- Methods
-
getNumericValue
public static int getNumericValue(char ch)
Returns the representation of the specified Unicode characterintvalue. For example, the character'\u216C'The int with value 50 will be returned (Roman numeral 50).Uppercase letters A-Z (
'\u0041'to'\u005A'), lowercase letters ('\u0061'to'\u007A') and fullwidth variants ('\uFF21'to'\uFF3A'and'\uFF41'to'\uFF5A'Numeric values in the form of ) are from 10 to 35'\uFF5A'This is not related to the Unicode specification and will not be for these.charassigns numeric values.If the character has no numeric value, returns -1. If the numeric value of the character cannot be represented as a non-negative integer (for example, a fractional value), -2 is returned.
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
getNumericValue(int)method.- Parameter
-
ch- the character to be converted. - Result
-
The numeric value of the character, as a non-negative
intvalue; -2 if the character has a numeric value but the value cannot be represented as a non-negativeintvalue; If the character has no numeric value, returns -1. - Starting from the following version:
- 1.1
- See also:
-
forDigit(int, int),isDigit(char)
-
getNumericValue
public static int getNumericValue(int codePoint)
Returns the representation of the specified character (Unicode code point)intvalue. For example, the character'\u216C'(Roman numeral 50) will return a value of 50int。In their uppercase (letters A-Z
'\u0041'Through'\u005A'), lowercase ('\u0061'Through'\u007A'() and fullwidth variants'\uFF21'Through'\uFF3A'and'\uFF41'Through'\uFF5A'the form have numeric values 10 through 35. This is independent of the Unicode specification, which does not assign to thesecharassigns numeric values.If the character has no numeric value, returns -1. If the numeric value of the character cannot be represented as a non-negative integer (for example, a fractional value), -2 is returned.
- Parameter
-
codePoint- The character (Unicode code point) to be converted. - Result
-
The numeric value of the character, as a non-negative
intvalue; -2 if the character has a numeric value but that value cannot be represented as a non-negativeintvalue; If the character has no numeric value, returns -1. - Starting from the following version:
- 1.5
- See also:
-
forDigit(int, int),isDigit(int)
-
isSpace
@Deprecated(since="1.1") public static boolean isSpace(char ch)
Deprecated.Replaced by isWhitespace(char).Determines whether the specified character is an ISO-LATIN-1 space. This method only returns the following five characters'true: truechars Character Code Name'\t'U+0009HORIZONTAL TABULATION'\n'U+000ANEW LINE'\f'U+000CFORM FEED'\r'U+000DCARRIAGE RETURN' 'U+0020SPACE- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is an ISO-LATIN-1 space; otherwise isfalse。 - See also:
-
isSpaceChar(char),isWhitespace(char)
-
isSpaceChar
public static boolean isSpaceChar(char ch)
Determines whether the specified character is a Unicode space character. A character is treated as a whitespace character if and only if the Unicode standard designates it as a whitespace character. This method returns true if the role's regular category type is any of the following:-
SPACE_SEPARATOR -
LINE_SEPARATOR -
PARAGRAPH_SEPARATOR
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isSpaceChar(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a space character; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isWhitespace(char)
-
-
isSpaceChar
public static boolean isSpaceChar(int codePoint)
Determines whether the specified character (Unicode code point) is a Unicode whitespace character. A character is treated as a whitespace character if and only if the Unicode standard designates it as a whitespace character. This method returns true if the role's regular category type is any of the following:- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a space character; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isWhitespace(int)
-
isWhitespace
public static boolean isWhitespace(char ch)
Determines whether the specified character is white space according to Java. A character is a Java whitespace character if and only if it satisfies one of the following conditions:- It is a Unicode space character (
SPACE_SEPARATOR,LINE_SEPARATOR, orPARAGRAPH_SEPARATOR), but also not a non-breaking space ('\u00A0','\u2007','\u202F')。 - It is
'\t',U + 0009 HORIZONTAL'\t'。 - It is
'\n',U + 000A LINE FEED。 - It is
'\u000B',U + 000B VERTICAL'\u000B'。 - It is
'\f',U + 000C FORM FEED。 - It is
'\r',U + 000D'\r'RETURN。 - It is
'\u001C',U + 001C FILE SEPARATOR。 - It is
'\u001D',U + 001D GROUP SEPARATOR。 - It is
'\u001E',U + 001E RECORD SEPARATOR。 - It is
'\u001F',U + 001F UNIT SEPARATOR。
Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isWhitespace(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is a Java whitespace character; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isSpaceChar(char)
- It is a Unicode space character (
-
isWhitespace
public static boolean isWhitespace(int codePoint)
Determines whether the specified character (Unicode code point) is whitespace according to Java. A character is a Java whitespace character if and only if it satisfies one of the following conditions:- It is a Unicode space character (
SPACE_SEPARATOR,LINE_SEPARATOR, orPARAGRAPH_SEPARATOR), but also not a non-breaking space ('\u00A0','\u2007','\u202F')。 - It is
'\t',U + 0009 HORIZONTAL'\t'。 - It is
'\n',U + 000A LINE FEED。 - It is
'\u000B',U + 000B VERTICAL'\u000B'。 - It is
'\f',U + 000C FORM FEED。 - This is
'\r',U + 000D'\r'RETURN。 - It is
'\u001C',U + 001C FILE SEPARATOR。 - It is
'\u001D',U + 001D GROUP SEPARATOR。 - It is
'\u001E',U + 001E RECORD SEPARATOR。 - It is
'\u001F',U + 001F UNIT SEPARATOR。
- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is a Java whitespace character; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isSpaceChar(int)
- It is a Unicode space character (
-
isISOControl
public static boolean isISOControl(char ch)
Determines whether the specified character is an ISO control character. A character is considered to be an ISO control character if its code is in the range.'\u0000'Through'\u001F'or in the range'\u007F'Through'\u009F'。Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isISOControl(int)method.- Parameter
-
ch- the character to be tested. - Result
-
trueIf the character is an ISO control character; otherwise isfalse。 - Starting from the following version:
- 1.1
- See also:
-
isSpaceChar(char),isWhitespace(char)
-
isISOControl
public static boolean isISOControl(int codePoint)
Determines whether the referenced character (Unicode code point) is an ISO control character. A character is considered to be an ISO control character if its code is in the range.'\u0000'Through'\u001F'or in the range'\u007F'Through'\u009F'。- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the role is an ISO control role; otherwise isfalse。 - Starting from the following version:
- 1.5
- See also:
-
isSpaceChar(int),isWhitespace(int)
-
getType
public static int getType(char ch)
Returns a value representing the general category of the character.Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
getType(int)method.- Parameter
-
ch- the character to be tested. - Result
- of type
intThe value representing the general category of the character. - Starting from the following version:
- 1.1
- See also:
-
COMBINING_SPACING_MARK,CONNECTOR_PUNCTUATION,CONTROL,CURRENCY_SYMBOL,DASH_PUNCTUATION,DECIMAL_DIGIT_NUMBER,ENCLOSING_MARK,END_PUNCTUATION,FINAL_QUOTE_PUNCTUATION,FORMAT,INITIAL_QUOTE_PUNCTUATION,LETTER_NUMBER,LINE_SEPARATOR,LOWERCASE_LETTER,MATH_SYMBOL,MODIFIER_LETTER,MODIFIER_SYMBOL,NON_SPACING_MARK,OTHER_LETTER,OTHER_NUMBER,OTHER_PUNCTUATION,OTHER_SYMBOL,PARAGRAPH_SEPARATOR,PRIVATE_USE,SPACE_SEPARATOR,START_PUNCTUATION,SURROGATE,TITLECASE_LETTER,UNASSIGNED,UPPERCASE_LETTER
-
getType
public static int getType(int codePoint)
Returns a value representing the general category of the character.- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
- of type
intThe value representing the general category of the character. - Starting from the following version:
- 1.5
- See also:
-
COMBINING_SPACING_MARK,CONNECTOR_PUNCTUATION,CONTROL,CURRENCY_SYMBOL,DASH_PUNCTUATION,DECIMAL_DIGIT_NUMBER,ENCLOSING_MARK,END_PUNCTUATION,FINAL_QUOTE_PUNCTUATION,FORMAT,INITIAL_QUOTE_PUNCTUATION,LETTER_NUMBER,LINE_SEPARATOR,LOWERCASE_LETTER,MATH_SYMBOL,MODIFIER_LETTER,MODIFIER_SYMBOL,NON_SPACING_MARK,OTHER_LETTER,OTHER_NUMBER,OTHER_PUNCTUATION,OTHER_SYMBOL,PARAGRAPH_SEPARATOR,PRIVATE_USE,SPACE_SEPARATOR,START_PUNCTUATION,SURROGATE,TITLECASE_LETTER,UNASSIGNED,UPPERCASE_LETTER
-
forDigit
public static char forDigit(int digit, int radix)Determines the character representation for a specific digit in the specified radix. if the valueradixis not a valid radix, or the valuedigitIf it is not a valid digit in the specified radix, the null character is returned ('\u0000')。that
radixThe argument is valid if it is greater than or equal toMIN_RADIXand less than or equal toMAX_RADIX。 if0 <= digit < radix, thendigitThe parameter is valid.If the number is less than 10, then returns
'0' + digit。 Otherwise, the return value'a' + digit - 10。- Parameter
-
digit- the digit to be converted into a character. -
radix- radix. - Result
- of the specified digit in the specified radix
charRepresentation form. - See also:
-
MIN_RADIX,MAX_RADIX,digit(char, int)
-
getDirectionality
public static byte getDirectionality(char ch)
Returns the Unicode directionality property of the given character. Character directionality is used to compute the visual ordering of text. undefinedcharThe value's directionality value isDIRECTIONALITY_UNDEFINED。Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
getDirectionality(int)method.- Parameter
-
ch-char, whose directionality property is requested. - Result
-
charThe directionality property of the value. - Starting from the following version:
- 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,DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE,DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE,DIRECTIONALITY_FIRST_STRONG_ISOLATE,DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE
-
getDirectionality
public static byte getDirectionality(int codePoint)
Returns the Unicode directionality property of the given character (Unicode code point). Character directionality is used to compute the visual ordering of text. The directionality value of undefined characters isDIRECTIONALITY_UNDEFINED。- Parameter
-
codePoint- The character (Unicode code point) for which the directionality property is requested. - Result
- Directionality of the character.
- Starting from the following version:
- 1.5
- 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,DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE,DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE,DIRECTIONALITY_FIRST_STRONG_ISOLATE,DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE
-
isMirrored
public static boolean isMirrored(char ch)
Determines whether the character is mirrored according to the Unicode specification. When displayed as right-to-left text, mirror characters should mirror their glyphs horizontally. For example,'\u0028'LEFT PARENTHESIS is semantically defined as leftBrackets 。 This will display as '(' in left-to-right text, but as ')' in right-to-left text.Note:this method cannot handlesupplementary characters 。 To support all Unicode characters (including supplementary characters), use
isMirrored(int)method.- Parameter
-
ch-char, requesting mirroring property - Result
-
trueIf the char is mirrored, thenfalseifcharunmirrored or undefined. - Starting from the following version:
- 1.4
-
isMirrored
public static boolean isMirrored(int codePoint)
Determines whether the specified character (Unicode code point) is mirrored according to the Unicode specification. When displayed as right-to-left text, mirror characters should mirror their glyphs horizontally. For example,'\u0028'LEFT PARENTHESIS is semantically defined as leftBrackets 。 This will display as '(' in left-to-right text, but as ')' in right-to-left text.- Parameter
-
codePoint- The character (Unicode code point) to be tested. - Result
-
trueIf the character is mirrored,falseIf the character is not mirrored or is not defined. - Starting from the following version:
- 1.5
-
compareTo
public int compareTo(Character anotherCharacter)
Compares two numericallyCharacterObject.- Specified by:
-
compareToIn the interfaceComparable<Character> - Parameter
-
anotherCharacter- to be comparedCharacter。 - Result
-
Value
0if the parameterCharacterequals thisCharacter; the value is less than0, if thisCharacteris numerically less thanCharacterparameter; if thisCharacteris numerically greater thanCharacterParameter (unsigned comparison), then the value is greater than0。 Note that this is a strict numeric comparison; It does not depend on the locale. - Starting from the following version:
- 1.2
-
compare
public static int compare(char x, char y)Compares two numericallycharvalue. The returned value is the same as the returned value:Character.valueOf(x).compareTo(Character.valueOf(y))- Parameter
-
x- the firstcharto compare -
y- the secondcharto compare - Result
-
Value
0ifx == y; less than0the value, ifx < y; If it is0then the value is greater thanx > y - Starting from the following version:
- 1.7
-
reverseBytes
public static char reverseBytes(char ch)
Returns the reverse of the specifiedcharthe value obtained from the byte order in the value.- Parameter
-
ch- whereincharReverses the byte order. - Result
- By reversing (or, equivalently, swapping) the specified
charThe value obtained from the bytes in the value. - Starting from the following version:
- 1.5
-
getName
public static String getName(int codePoint)
Returns the specified charactercodePointthe Unicode name of, if the code point isunassigned, then returns null.Note: if not passedUnicodeDataFile(byUnicode ConsortiumMaintenanceofUnicodeCharacterdatabaseofonePart)isspecifiedCharacterDivideallocateName, then returnsname ofandExpressionofResultSame.
Character.UnicodeBlock.of(codePoint).toString().replace('_', ' ') + " " + Integer.toHexString(codePoint).toUpperCase(Locale.ROOT);- Parameter
-
codePoint- Character (Unicode code point) - Result
- The Unicode name of the specified character, or null if the code point is unassigned.
- Exception
-
IllegalArgumentException- if the specifiedcodePointNot a valid Unicode code point. - Starting from the following version:
- 1.7
-
codePointOf
public static int codePointOf(String name)
Returns the code point value of the Unicode character specified by the given Unicode character name.Note: ifUnicodeDataFile(byUnicode ConsortiumMaintenanceofUnicodeCharacterdatabaseofonePart)未isCharacterDivideallocateName, thenitsNamewillDefined asExpressionofResult
Character.UnicodeBlock.of(codePoint).toString().replace('_', ' ') + " " + Integer.toHexString(codePoint).toUpperCase(Locale.ROOT);nameCase-insensitive match, with any leading and trailing whitespace characters removed.- Parameter
-
name- the Unicode character name - Result
- The code point value of the character specified by its name.
- Exception
-
IllegalArgumentException- if the specifiednameNot a valid Unicode character name. -
NullPointerException- ifnameYesnull - Starting from the following version:
- 9
-
-