Inaddition,thisclassprovidesseveralmethodsfordeterminingacharacter'scategory(lowercaseletter,digit,etc.)andforconvertingcharactersfromuppercasetolowercaseandviceversa.
CharacterinformationisbasedontheUnicodeStandard
ThemethodsanddataofclassCharacteraredefinedbytheinformationintheUnicodeDatafilethatispartoftheUnicodeCharacterDatabasemaintainedbytheUnicodeConsortium.ThisfilespecifiesvariouspropertiesincludingnameandgeneralcategoryforeverydefinedUnicodecodepointorcharacterrange.
ThefileanditsdescriptionareavailablefromtheUnicodeConsortiumat:
CharacterinformationisbasedontheUnicodeStandard,version15.0.
TheJavaplatformhassupporteddifferentversionsoftheUnicodeStandardovertime.UpgradestonewerversionsoftheUnicodeStandardoccurredinthefollowingJavareleases,eachindicatingthenewversion:
ThesetofcharactersfromU+0000toU+FFFFissometimesreferredtoastheBasicMultilingualPlane(BMP).CharacterswhosecodepointsaregreaterthanU+FFFFarecalledsupplementarycharacters.TheJavaplatformusestheUTF-16representationinchararraysandintheStringandStringBufferclasses.Inthisrepresentation,supplementarycharactersarerepresentedasapairofcharvalues,thefirstfromthehigh-surrogatesrange,(\uD800-\uDBFF),thesecondfromthelow-surrogatesrange(\uDC00-\uDFFF).
Acharvalue,therefore,representsBasicMultilingualPlane(BMP)codepoints,includingthesurrogatecodepoints,orcodeunitsoftheUTF-16encoding.AnintvaluerepresentsallUnicodecodepoints,includingsupplementarycodepoints.Thelower(leastsignificant)21bitsofintareusedtorepresentUnicodecodepointsandtheupper(mostsignificant)11bitsmustbezero.Unlessotherwisespecified,thebehaviorwithrespecttosupplementarycharactersandsurrogatecharvaluesisasfollows:
InstancesofthisclassrepresentparticularsubsetsoftheUnicodecharacterset.
AfamilyofcharactersubsetsrepresentingthecharacterblocksintheUnicodespecification.
Thenumberofbytesusedtorepresentacharvalueinunsignedbinaryform.
Generalcategory"Mc"intheUnicodespecification.
Generalcategory"Pc"intheUnicodespecification.
Generalcategory"Cc"intheUnicodespecification.
Generalcategory"Sc"intheUnicodespecification.
Generalcategory"Pd"intheUnicodespecification.
Generalcategory"Nd"intheUnicodespecification.
Weakbidirectionalcharactertype"AN"intheUnicodespecification.
Weakbidirectionalcharactertype"BN"intheUnicodespecification.
Weakbidirectionalcharactertype"CS"intheUnicodespecification.
Weakbidirectionalcharactertype"EN"intheUnicodespecification.
Weakbidirectionalcharactertype"ES"intheUnicodespecification.
Weakbidirectionalcharactertype"ET"intheUnicodespecification.
Weakbidirectionalcharactertype"FSI"intheUnicodespecification.
Strongbidirectionalcharactertype"L"intheUnicodespecification.
Strongbidirectionalcharactertype"LRE"intheUnicodespecification.
Weakbidirectionalcharactertype"LRI"intheUnicodespecification.
Strongbidirectionalcharactertype"LRO"intheUnicodespecification.
Weakbidirectionalcharactertype"NSM"intheUnicodespecification.
Neutralbidirectionalcharactertype"ON"intheUnicodespecification.
Neutralbidirectionalcharactertype"B"intheUnicodespecification.
Weakbidirectionalcharactertype"PDF"intheUnicodespecification.
Weakbidirectionalcharactertype"PDI"intheUnicodespecification.
Strongbidirectionalcharactertype"R"intheUnicodespecification.
Strongbidirectionalcharactertype"AL"intheUnicodespecification.
Strongbidirectionalcharactertype"RLE"intheUnicodespecification.
Weakbidirectionalcharactertype"RLI"intheUnicodespecification.
Strongbidirectionalcharactertype"RLO"intheUnicodespecification.
Neutralbidirectionalcharactertype"S"intheUnicodespecification.
Undefinedbidirectionalcharactertype.
Neutralbidirectionalcharactertype"WS"intheUnicodespecification.
Generalcategory"Me"intheUnicodespecification.
Generalcategory"Pe"intheUnicodespecification.
Generalcategory"Pf"intheUnicodespecification.
Generalcategory"Cf"intheUnicodespecification.
Generalcategory"Pi"intheUnicodespecification.
Generalcategory"Nl"intheUnicodespecification.
Generalcategory"Zl"intheUnicodespecification.
Generalcategory"Ll"intheUnicodespecification.
Generalcategory"Sm"intheUnicodespecification.
Themaximumradixavailableforconversiontoandfromstrings.
ThemaximumvalueofaUnicodesurrogatecodeunitintheUTF-16encoding,constant'\u005CuDFFF'.
Theconstantvalueofthisfieldisthelargestvalueoftypechar,'\u005CuFFFF'.
Theminimumradixavailableforconversiontoandfromstrings.
TheminimumvalueofaUnicodesurrogatecodeunitintheUTF-16encoding,constant'\u005CuD800'.
Theconstantvalueofthisfieldisthesmallestvalueoftypechar,'\u005Cu0000'.
Generalcategory"Lm"intheUnicodespecification.
Generalcategory"Sk"intheUnicodespecification.
Generalcategory"Mn"intheUnicodespecification.
Generalcategory"Lo"intheUnicodespecification.
Generalcategory"No"intheUnicodespecification.
Generalcategory"Po"intheUnicodespecification.
Generalcategory"So"intheUnicodespecification.
Generalcategory"Zp"intheUnicodespecification.
Generalcategory"Co"intheUnicodespecification.
Thenumberofbitsusedtorepresentacharvalueinunsignedbinaryform,constant16.
Generalcategory"Zs"intheUnicodespecification.
Generalcategory"Ps"intheUnicodespecification.
Generalcategory"Cs"intheUnicodespecification.
Generalcategory"Lt"intheUnicodespecification.
Generalcategory"Cn"intheUnicodespecification.
Generalcategory"Lu"intheUnicodespecification.
ConstructsanewlyallocatedCharacterobjectthatrepresentsthespecifiedcharvalue.
Determinesthenumberofcharvaluesneededtorepresentthespecifiedcharacter(Unicodecodepoint).
ReturnsthevalueofthisCharacterobject.
Returnsthecodepointatthegivenindexofthechararray.
Returnsthecodepointatthegivenindexofthechararray,whereonlyarrayelementswithindexlessthanlimitcanbeused.
ReturnsthecodepointatthegivenindexoftheCharSequence.
Returnsthecodepointprecedingthegivenindexofthechararray.
Returnsthecodepointprecedingthegivenindexofthechararray,whereonlyarrayelementswithindexgreaterthanorequaltostartcanbeused.
ReturnsthecodepointprecedingthegivenindexoftheCharSequence.
ReturnsthenumberofUnicodecodepointsinasubarrayofthechararrayargument.
ReturnsthenumberofUnicodecodepointsinthetextrangeofthespecifiedcharsequence.
ReturnsthecodepointvalueoftheUnicodecharacterspecifiedbythegivencharactername.
Comparestwocharvaluesnumerically.
ComparestwoCharacterobjectsnumerically.
Returnsthenumericvalueofthecharacterchinthespecifiedradix.
Returnsthenumericvalueofthespecifiedcharacter(Unicodecodepoint)inthespecifiedradix.
Comparesthisobjectagainstthespecifiedobject.
Determinesthecharacterrepresentationforaspecificdigitinthespecifiedradix.
ReturnstheUnicodedirectionalitypropertyforthegivencharacter.
ReturnstheUnicodedirectionalitypropertyforthegivencharacter(Unicodecodepoint).
ReturnstheintvaluethatthespecifiedUnicodecharacterrepresents.
Returnstheintvaluethatthespecifiedcharacter(Unicodecodepoint)represents.
Returnsavalueindicatingacharacter'sgeneralcategory.
ReturnsahashcodeforthisCharacter;equaltotheresultofinvokingcharValue().
Returnsahashcodeforacharvalue;compatiblewithCharacter.hashCode().
Determinesifthespecifiedcharacter(Unicodecodepoint)isalphabetic.
DeterminesifacharacterisdefinedinUnicode.
Determinesifacharacter(Unicodecodepoint)isdefinedinUnicode.
Determinesifthespecifiedcharacterisadigit.
Determinesifthespecifiedcharacter(Unicodecodepoint)isadigit.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanEmoji.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanEmojiComponent.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanEmojiModifier.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanEmojiModifierBase.
Determinesifthespecifiedcharacter(Unicodecodepoint)hastheEmojiPresentationpropertybydefault.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanExtendedPictographic.
DeterminesifthespecifiedcharacterisanISOcontrolcharacter.
Determinesifthereferencedcharacter(Unicodecodepoint)isanISOcontrolcharacter.
DeterminesifthespecifiedcharactershouldberegardedasanignorablecharacterinaJavaidentifieroraUnicodeidentifier.
Determinesifthespecifiedcharacter(Unicodecodepoint)shouldberegardedasanignorablecharacterinaJavaidentifieroraUnicodeidentifier.
Determinesifthespecifiedcharacter(Unicodecodepoint)isaCJKV(Chinese,Japanese,KoreanandVietnamese)ideograph,asdefinedbytheUnicodeStandard.
DeterminesifthespecifiedcharactermaybepartofaJavaidentifierasotherthanthefirstcharacter.
Determinesifthecharacter(Unicodecodepoint)maybepartofaJavaidentifierasotherthanthefirstcharacter.
DeterminesifthespecifiedcharacterispermissibleasthefirstcharacterinaJavaidentifier.
Determinesifthecharacter(Unicodecodepoint)ispermissibleasthefirstcharacterinaJavaidentifier.
Determinesifthespecifiedcharacterisaletter.
Determinesifthespecifiedcharacter(Unicodecodepoint)isaletter.
Determinesifthespecifiedcharacterisaletterordigit.
Determinesifthespecifiedcharacter(Unicodecodepoint)isaletterordigit.
Determinesifthespecifiedcharacterisalowercasecharacter.
Determinesifthespecifiedcharacter(Unicodecodepoint)isalowercasecharacter.
DetermineswhetherthecharacterismirroredaccordingtotheUnicodespecification.
Determineswhetherthespecifiedcharacter(Unicodecodepoint)ismirroredaccordingtotheUnicodespecification.
DeterminesifthespecifiedcharacterisISO-LATIN-1whitespace.
DeterminesifthespecifiedcharacterisaUnicodespacecharacter.
Determinesifthespecifiedcharacter(Unicodecodepoint)isaUnicodespacecharacter.
DeterminesifthegivencharvalueisaUnicodesurrogatecodeunit.
Determinesifthespecifiedcharacterisatitlecasecharacter.
Determinesifthespecifiedcharacter(Unicodecodepoint)isatitlecasecharacter.
DeterminesifthespecifiedcharactermaybepartofaUnicodeidentifierasotherthanthefirstcharacter.
Determinesifthespecifiedcharacter(Unicodecodepoint)maybepartofaUnicodeidentifierasotherthanthefirstcharacter.
DeterminesifthespecifiedcharacterispermissibleasthefirstcharacterinaUnicodeidentifier.
Determinesifthespecifiedcharacter(Unicodecodepoint)ispermissibleasthefirstcharacterinaUnicodeidentifier.
Determinesifthespecifiedcharacterisanuppercasecharacter.
Determinesifthespecifiedcharacter(Unicodecodepoint)isanuppercasecharacter.
DeterminesifthespecifiedcharacteriswhitespaceaccordingtoJava.
Determinesifthespecifiedcharacter(Unicodecodepoint)iswhitespaceaccordingtoJava.
ReturnstheindexwithinthegivencharsubarraythatisoffsetfromthegivenindexbycodePointOffsetcodepoints.
ReturnstheindexwithinthegivencharsequencethatisoffsetfromthegivenindexbycodePointOffsetcodepoints.
Returnsthevalueobtainedbyreversingtheorderofthebytesinthespecifiedcharvalue.
Convertsthespecifiedcharacter(Unicodecodepoint)toitsUTF-16representationstoredinachararray.
Convertsthespecifiedcharacter(Unicodecodepoint)toitsUTF-16representation.
Convertsthespecifiedsurrogatepairtoitssupplementarycodepointvalue.
ConvertsthecharacterargumenttolowercaseusingcasemappinginformationfromtheUnicodeDatafile.
Convertsthecharacter(Unicodecodepoint)argumenttolowercaseusingcasemappinginformationfromtheUnicodeDatafile.
ReturnsaStringobjectrepresentingthisCharacter'svalue.
ReturnsaStringobjectrepresentingthespecifiedchar.
ReturnsaStringobjectrepresentingthespecifiedcharacter(Unicodecodepoint).
ConvertsthecharacterargumenttotitlecaseusingcasemappinginformationfromtheUnicodeDatafile.
Convertsthecharacter(Unicodecodepoint)argumenttotitlecaseusingcasemappinginformationfromtheUnicodeDatafile.
ConvertsthecharacterargumenttouppercaseusingcasemappinginformationfromtheUnicodeDatafile.
Convertsthecharacter(Unicodecodepoint)argumenttouppercaseusingcasemappinginformationfromtheUnicodeDatafile.
ReturnsaCharacterinstancerepresentingthespecifiedcharvalue.
TheClassinstancerepresentingtheprimitivetypechar.
Value:36SeeAlso
Value:2SeeAlso
SeeAlso
IfacharacterisnotassignedanamebytheUnicodeDatafile(partoftheUnicodeCharacterDatabasemaintainedbytheUnicodeConsortium),itsnameisdefinedastheresultoftheexpression:
IftheradixisnotintherangeMIN_RADIX≤radix≤MAX_RADIXorifthevalueofchisnotavaliddigitinthespecifiedradix,-1isreturned.Acharacterisavaliddigitifatleastoneofthefollowingistrue:
IftheradixisnotintherangeMIN_RADIX≤radix≤MAX_RADIXorifthecharacterisnotavaliddigitinthespecifiedradix,-1isreturned.Acharacterisavaliddigitifatleastoneofthefollowingistrue:
TheradixargumentisvalidifitisgreaterthanorequaltoMIN_RADIXandlessthanorequaltoMAX_RADIX.Thedigitargumentisvalidif0<=digit Ifthedigitislessthan10,then'0'+digitisreturned.Otherwise,thevalue'a'+digit-10isreturned. IfthespecifiedcharacterisnotassignedanamebytheUnicodeDatafile(partoftheUnicodeCharacterDatabasemaintainedbytheUnicodeConsortium),thereturnednameisthesameastheresultoftheexpression: ThelettersA-Zintheiruppercase('\u005Cu0041'through'\u005Cu005A'),lowercase('\u005Cu0061'through'\u005Cu007A'),andfullwidthvariant('\u005CuFF21'through'\u005CuFF3A'and'\u005CuFF41'through'\u005CuFF5A')formshavenumericvaluesfrom10through35.ThisisindependentoftheUnicodespecification,whichdoesnotassignnumericvaluestothesecharvalues. Ifthecharacterdoesnothaveanumericvalue,then-1isreturned.Ifthecharacterhasanumericvaluethatcannotberepresentedasanonnegativeinteger(forexample,afractionalvalue),then-2isreturned. Acharacterisdefinedifatleastoneofthefollowingistrue: Acharacterisadigitifitsgeneralcategorytype,providedbyCharacter.getType(ch),isDECIMAL_DIGIT_NUMBER. SomeUnicodecharacterrangesthatcontaindigits: ThefollowingUnicodecharactersareignorableinaJavaidentifieroraUnicodeidentifier: AcharactermaybepartofaJavaidentifierifanyofthefollowingconditionsaretrue: AcharactermaystartaJavaidentifierifandonlyifoneofthefollowingconditionsistrue: AcharactermaybepartofaJavaidentifierifandonlyifoneofthefollowingconditionsistrue: Acharacterisconsideredtobealetterifitsgeneralcategorytype,providedbyCharacter.getType(ch),isanyofthefollowing: AcharacterisconsideredtobealetterordigitifeitherCharacter.isLetter(charch)orCharacter.isDigit(charch)returnstrueforthecharacter. Acharacterislowercaseifitsgeneralcategorytype,providedbyCharacter.getType(ch),isLOWERCASE_LETTER,orithascontributorypropertyOther_LowercaseasdefinedbytheUnicodeStandard. Thefollowingareexamplesoflowercasecharacters: abcdefghijklmnopqrstuvwxyz'\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'ManyotherUnicodecharactersarelowercasetoo. Acharacterislowercaseifitsgeneralcategorytype,providedbyjava.lang.Character#getType,isLOWERCASE_LETTER,orithascontributorypropertyOther_LowercaseasdefinedbytheUnicodeStandard. DeterminesifthespecifiedcharacterisISO-LATIN-1whitespace.Thismethodreturnstrueforthefollowingfivecharactersonly:truecharsCharacterCodeName'\t'U+0009HORIZONTALTABULATION'\n'U+000ANEWLINE'\f'U+000CFORMFEED'\r'U+000DCARRIAGERETURN''U+0020SPACE Thismethodisequivalenttotheexpression: Acharacterisatitlecasecharacterifitsgeneralcategorytype,providedbyCharacter.getType(ch),isTITLECASE_LETTER. SomecharacterslooklikepairsofLatinletters.Forexample,thereisanuppercaseletterthatlookslike"LJ"andhasacorrespondinglowercaseletterthatlookslike"lj".Athirdform,whichlookslike"Lj",istheappropriateformtousewhenrenderingawordinlowercasewithinitialcapitals,asforabooktitle. ThesearesomeoftheUnicodecharactersforwhichthismethodreturnstrue: ManyotherUnicodecharactersaretitlecasetoo. AcharactermaybepartofaUnicodeidentifierifandonlyifoneofthefollowingstatementsistrue: AcharactermaystartaUnicodeidentifierifandonlyifoneofthefollowingconditionsistrue: Acharacterisuppercaseifitsgeneralcategorytype,providedbyCharacter.getType(ch),isUPPERCASE_LETTER.orithascontributorypropertyOther_UppercaseasdefinedbytheUnicodeStandard. Thefollowingareexamplesofuppercasecharacters: ABCDEFGHIJKLMNOPQRSTUVWXYZ'\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'ManyotherUnicodecharactersareuppercasetoo. NotethatCharacter.isLowerCase(Character.toLowerCase(ch))doesnotalwaysreturntrueforsomerangesofcharacters,particularlythosethataresymbolsorideographs. NotethatCharacter.isLowerCase(Character.toLowerCase(codePoint))doesnotalwaysreturntrueforsomerangesofcharacters,particularlythosethataresymbolsorideographs. NotethatCharacter.isTitleCase(Character.toTitleCase(ch))doesnotalwaysreturntrueforsomerangesofcharacters. NotethatCharacter.isTitleCase(Character.toTitleCase(codePoint))doesnotalwaysreturntrueforsomerangesofcharacters. NotethatCharacter.isUpperCase(Character.toUpperCase(ch))doesnotalwaysreturntrueforsomerangesofcharacters,particularlythosethataresymbolsorideographs. NotethatCharacter.isUpperCase(Character.toUpperCase(codePoint))doesnotalwaysreturntrueforsomerangesofcharacters,particularlythosethataresymbolsorideographs.