#include <unicode.h>
Public Types | |
enum | { MIN_VALUE = 0, MAX_VALUE = 0x10ffff, MAX_CHAR_LENGTH = UTF_MAX_CHAR_LENGTH, MIN_RADIX = 2, MAX_RADIX = 36 } |
enum | EUnicodeGeneralTypes { UNASSIGNED = 0, UPPERCASE_LETTER = 1, LOWERCASE_LETTER = 2, TITLECASE_LETTER = 3, MODIFIER_LETTER = 4, OTHER_LETTER = 5, NON_SPACING_MARK = 6, ENCLOSING_MARK = 7, COMBINING_SPACING_MARK = 8, DECIMAL_DIGIT_NUMBER = 9, LETTER_NUMBER = 10, OTHER_NUMBER = 11, SPACE_SEPARATOR = 12, LINE_SEPARATOR = 13, PARAGRAPH_SEPARATOR = 14, CONTROL = 15, FORMAT = 16, PRIVATE_USE = 17, SURROGATE = 18, DASH_PUNCTUATION = 19, START_PUNCTUATION = 20, END_PUNCTUATION = 21, CONNECTOR_PUNCTUATION = 22, OTHER_PUNCTUATION = 23, MATH_SYMBOL = 24, CURRENCY_SYMBOL = 25, MODIFIER_SYMBOL = 26, OTHER_SYMBOL = 27, INITIAL_PUNCTUATION = 28, FINAL_PUNCTUATION = 29, GENERAL_TYPES_COUNT = 30 } |
Public data for enumerated Unicode general category types. More... | |
enum | EUnicodeScript { kBasicLatin = UBLOCK_BASIC_LATIN, kLatin1Supplement, kLatinExtendedA, kLatinExtendedB, kIPAExtension, kSpacingModifier, kCombiningDiacritical, kGreek, kCyrillic, kArmenian, kHebrew, kArabic, kSyriac, kThaana, kDevanagari, kBengali, kGurmukhi, kGujarati, kOriya, kTamil, kTelugu, kKannada, kMalayalam, kSinhala, kThai, kLao, kTibetan, kMyanmar, kGeorgian, kHangulJamo, kEthiopic, kCherokee, kUnifiedCanadianAboriginalSyllabics, kogham, kRunic, kKhmer, kMongolian, kLatinExtendedAdditional, kGreekExtended, kGeneralPunctuation, kSuperSubScript, kCurrencySymbolScript, kSymbolCombiningMark, kLetterlikeSymbol, kNumberForm, kArrow, kMathOperator, kMiscTechnical, kControlPicture, kOpticalCharacter, kEnclosedAlphanumeric, kBoxDrawing, kBlockElement, kGeometricShape, kMiscSymbol, kDingbat, kBraillePatterns, kCJKRadicalsSupplement, kKangxiRadicals, kIdeographicDescriptionCharacters, kCJKSymbolPunctuation, kHiragana, kKatakana, kBopomofo, kHangulCompatibilityJamo, kKanbun, kBopomofoExtended, kEnclosedCJKLetterMonth, kCJKCompatibility, kCJKUnifiedIdeographExtensionA, kCJKUnifiedIdeograph, kYiSyllables, kYiRadicals, kHangulSyllable, kHighSurrogate, kHighPrivateUseSurrogate, kLowSurrogate, kPrivateUse, kCJKCompatibilityIdeograph, kAlphabeticPresentation, kArabicPresentationA, kCombiningHalfMark, kCJKCompatibilityForm, kSmallFormVariant, kArabicPresentationB, kNoScript, kHalfwidthFullwidthForm, kScriptCount = UBLOCK_COUNT } |
These are the same values as uchar.h::UCharScript. More... | |
enum | EDirectionProperty { LEFT_TO_RIGHT = 0, RIGHT_TO_LEFT = 1, EUROPEAN_NUMBER = 2, EUROPEAN_NUMBER_SEPARATOR = 3, EUROPEAN_NUMBER_TERMINATOR = 4, ARABIC_NUMBER = 5, COMMON_NUMBER_SEPARATOR = 6, BLOCK_SEPARATOR = 7, SEGMENT_SEPARATOR = 8, WHITE_SPACE_NEUTRAL = 9, OTHER_NEUTRAL = 10, LEFT_TO_RIGHT_EMBEDDING = 11, LEFT_TO_RIGHT_OVERRIDE = 12, RIGHT_TO_LEFT_ARABIC = 13, RIGHT_TO_LEFT_EMBEDDING = 14, RIGHT_TO_LEFT_OVERRIDE = 15, POP_DIRECTIONAL_FORMAT = 16, DIR_NON_SPACING_MARK = 17, BOUNDARY_NEUTRAL = 18 } |
This specifies the language directional property of a character set. More... | |
enum | ECellWidths { ZERO_WIDTH = 0, HALF_WIDTH = 1, FULL_WIDTH = 2, NEUTRAL = 3 } |
Values returned by the getCellWidth() function. More... | |
Static Public Member Functions | |
UBool | isSingle (UChar c) |
Does this code unit alone represent a Unicode code point? If so, then the code point value is the same as the code unit value, or (UChar32)c . | |
UBool | isLead (UChar c) |
Is this code unit the first of a multiple-unit sequence? Being a single, lead, or trail unit are mutually exclusive properties. | |
UBool | isTrail (UChar c) |
Is this code unit one of, but not the first, of a multiple-unit sequence? Being a single, lead, or trail unit are mutually exclusive properties. | |
UBool | isSurrogate (UChar32 c) |
Is this code point a surrogate character? Surrogates are not characters; they are reserved for use in UTF-16 strings as leading and trailing code units of multiple-unit sequences for single code points. | |
UBool | isUnicodeChar (UChar32 c) |
Is this code point a Unicode character? The value range for Unicode characters is limited to 0x10ffff==MAX_VALUE, and some values within this range are reserved and not characters, too. | |
UBool | isError (UChar32 c) |
Is this code point an error value? In ICU, code point access with macros or functions does not result in a UErrorCode to be set if a code unit sequence is illegal or irregular, but instead the resulting code point will be one of few special error values. | |
UBool | isValid (UChar32 c) |
Is this code point a Unicode character, and not an error value? This is an efficient combination of isUnicodeChar(c) && !isError(c) . | |
UBool | needMultipleUChar (UChar32 c) |
When writing code units for a given code point, is more than one code unit necessary? If not, then a single UChar value of (UChar)c can be written to a UChar array. | |
int32_t | charLength (UChar32 c) |
When writing code units for a given code point, how many code units are necessary? | |
int32_t | arraySize (int32_t size) |
This function returns an average size of a UChar array compared to the size that it would need to hold similar text if UTF-16 were used. | |
UBool | isLowerCase (UChar32 ch) |
Determines whether the specified UChar is a lowercase character according to Unicode 2.1.2. | |
UBool | isUpperCase (UChar32 ch) |
Determines whether the specified character is an uppercase character according to Unicode 2.1.2. | |
UBool | isTitleCase (UChar32 ch) |
Determines whether the specified character is a titlecase character according to Unicode 2.1.2. | |
UBool | isDigit (UChar32 ch) |
Determines whether the specified character is a digit according to Unicode 2.1.2. | |
UBool | isDefined (UChar32 ch) |
Determines whether the specified numeric value is actually a defined character according to Unicode 2.1.2. | |
UBool | isControl (UChar32 ch) |
Determines whether the specified character is a control character according to Unicode 2.1.2. | |
UBool | isPrintable (UChar32 ch) |
Determines whether the specified character is a printable character according to Unicode 2.1.2. | |
UBool | isBaseForm (UChar32 ch) |
Determines whether the specified character is of the base form according to Unicode 2.1.2. | |
UBool | isLetter (UChar32 ch) |
Determines whether the specified character is a letter according to Unicode 2.1.2. | |
UBool | isJavaIdentifierStart (UChar32 ch) |
A convenience method for determining if a Unicode character is allowed as the first character in a Java identifier. | |
UBool | isJavaIdentifierPart (UChar32 ch) |
A convenience method for determining if a Unicode character may be part of a Java identifier other than the starting character. | |
UBool | isUnicodeIdentifierStart (UChar32 ch) |
A convenience method for determining if a Unicode character is allowed to start in a Unicode identifier. | |
UBool | isUnicodeIdentifierPart (UChar32 ch) |
A convenience method for determining if a Unicode character may be part of a Unicode identifier other than the starting character. | |
UBool | isIdentifierIgnorable (UChar32 ch) |
A convenience method for determining if a Unicode character should be regarded as an ignorable character in a Java identifier or a Unicode identifier. | |
UChar32 | toLowerCase (UChar32 ch) |
The given character is mapped to its lowercase equivalent according to Unicode 2.1.2; if the character has no lowercase equivalent, the character itself is returned. | |
UChar32 | toUpperCase (UChar32 ch) |
The given character is mapped to its uppercase equivalent according to Unicode 2.1.2; if the character has no uppercase equivalent, the character itself is returned. | |
UChar32 | toTitleCase (UChar32 ch) |
The given character is mapped to its titlecase equivalent according to Unicode 2.1.2. | |
UChar32 | foldCase (UChar32 c, uint32_t options) |
The given character is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if the character has no case folding equivalent, the character itself is returned. | |
UBool | isSpaceChar (UChar32 ch) |
Determines if the specified character is a Unicode space character according to Unicode 2.1.2. | |
UBool | isWhitespace (UChar32 ch) |
Determines if the specified character is white space according to ICU. | |
int8_t | getType (UChar32 ch) |
Returns a value indicating a character category according to Unicode 2.1.2. | |
uint8_t | getCombiningClass (UChar32 c) |
Returns the combining class of the code point as specified in UnicodeData.txt. | |
EDirectionProperty | characterDirection (UChar32 ch) |
Returns the linguistic direction property of a character. | |
UBool | isMirrored (UChar32 c) |
Determines whether the character has the "mirrored" property. | |
UChar32 | charMirror (UChar32 c) |
Maps the specified character to a "mirror-image" character. | |
EUnicodeScript | getScript (UChar32 ch) |
Returns the script associated with a character. | |
uint16_t | getCellWidth (UChar32 ch) |
Returns a value indicating the display-cell width of the character when used in Asian text, according to the Unicode standard (see p. | |
int32_t | getCharName (uint32_t code, char *buffer, int32_t bufferLength, UCharNameChoice nameChoice=U_UNICODE_CHAR_NAME) |
Retrieve the name of a Unicode character. | |
int32_t | digitValue (UChar32 ch) |
Retrives the decimal numeric value of a digit character. | |
int32_t | digit (UChar32 ch, int8_t radix) |
Returns the numeric value of the character ch in the specified radix. | |
UChar32 | forDigit (int32_t digit, int8_t radix) |
Determines the character representation for a specific digit in the specified radix. | |
void | getUnicodeVersion (UVersionInfo info) |
Retrieves the Unicode Standard Version number that is used. | |
Protected Member Functions | |
Unicode (const Unicode &other) | |
const Unicode & | operator= (const Unicode &other) |
Use the C API, see uchar.h and utf.h. The Unicode class is a pure 1:1 wrapper for the functions and macros there.
Old documentation:
The Unicode class allows you to query the properties associated with individual Unicode character values.
The Unicode character information, provided implicitly by the Unicode Standard, includes information about the sript (for example, symbols or control characters) to which the character belongs, as well as semantic information such as whether a character is a digit or uppercase, lowercase, or uncased.
Do not subclass.
|
|
|
Values returned by the getCellWidth() function.
|
|
This specifies the language directional property of a character set.
|
|
Public data for enumerated Unicode general category types.
|
|
These are the same values as uchar.h::UCharScript.
|
|
This function returns an average size of a UChar array compared to the size that it would need to hold similar text if UTF-16 were used.
With UTF-16, this always returns its argument. With UTF-8, the number returned will be larger, with UTF-32, smaller. It will typically be less than
|
|
Returns the linguistic direction property of a character. Returns the linguistic direction property of a character. For example, 0x0041 (letter A) has the LEFT_TO_RIGHT directional property.
|
|
When writing code units for a given code point, how many code units are necessary?
|
|
Maps the specified character to a "mirror-image" character. For characters with the "mirrored" property, implementations sometimes need a "poor man's" mapping to another Unicode character (code point) such that the default glyph may serve as the mirror-image of the default glyph of the specified character. This is useful for text conversion to and from codepages with visual order, and for displays without glyph selecetion capabilities.
|
|
Returns the numeric value of the character
If the radix is not in the range
|
|
Retrives the decimal numeric value of a digit character.
|
|
The given character is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if the character has no case folding equivalent, the character itself is returned. Only "simple", single-code point case folding mappings are used. "Full" mappings are used by UnicodeString::foldCase().
|
|
Determines the character representation for a specific digit in the specified radix.
If the value of
The
If the digit is less than 10, then
|
|
Returns a value indicating the display-cell width of the character when used in Asian text, according to the Unicode standard (see p. 6-130 of The Unicode Standard, Version 2.0). The results for various characters are as follows: ZERO_WIDTH: Characters which are considered to take up no display-cell space: control characters format characters line and paragraph separators non-spacing marks combining Hangul jungseong combining Hangul jongseong unassigned Unicode values HALF_WIDTH: Characters which take up half a cell in standard Asian text: all characters in the General Scripts Area except combining Hangul choseong and the characters called out specifically above as ZERO_WIDTH alphabetic and Arabic presentation forms halfwidth CJK punctuation halfwidth Katakana halfwidth Hangul Jamo halfwidth forms, arrows, and shapes FULL_WIDTH: Characters which take up a full cell in standard Asian text: combining Hangul choseong all characters in the CJK Phonetics and Symbols Area all characters in the CJK Ideographs Area all characters in the Hangul Syllables Area CJK compatibility ideographs CJK compatibility forms small form variants fullwidth ASCII fullwidth punctuation and currency signs NEUTRAL: Characters whose cell width is context-dependent: all characters in the Symbols Area, except those specifically called out above all characters in the Surrogates Area all charcaters in the Private Use Area For Korean text, this algorithm should work properly with properly normalized Korean text. Precomposed Hangul syllables and non-combining jamo are all considered full- width characters. For combining jamo, we treat we treat choseong (initial consonants) as double-width characters and junseong (vowels) and jongseong (final consonants) as non-spacing marks. This will work right in text that uses the precomposed choseong characters instead of teo choseong characters in a row, and which uses the choseong filler character at the beginning of syllables that don't have an initial consonant. The results may be slightly off with Korean text following different conventions.
|
|
Retrieve the name of a Unicode character.
Depending on
|
|
Returns the combining class of the code point as specified in UnicodeData.txt.
|
|
Returns the script associated with a character.
|
|
Returns a value indicating a character category according to Unicode 2.1.2.
|
|
Retrieves the Unicode Standard Version number that is used.
|
|
Determines whether the specified character is of the base form according to Unicode 2.1.2.
|
|
Determines whether the specified character is a control character according to Unicode 2.1.2.
|
|
Determines whether the specified numeric value is actually a defined character according to Unicode 2.1.2.
|
|
Determines whether the specified character is a digit according to Unicode 2.1.2.
|
|
Is this code point an error value? In ICU, code point access with macros or functions does not result in a UErrorCode to be set if a code unit sequence is illegal or irregular, but instead the resulting code point will be one of few special error values. This function tests for one of those.
|
|
A convenience method for determining if a Unicode character should be regarded as an ignorable character in a Java identifier or a Unicode identifier. The following Unicode characters are ignorable in a Java identifier or a Unicode identifier:
|
|
A convenience method for determining if a Unicode character may be part of a Java identifier other than the starting character. A character may be part of a Java identifier if and only if it is one of the following:
|
|
A convenience method for determining if a Unicode character is allowed as the first character in a Java identifier. A character may start a Java identifier if and only if it is one of the following:
|
|
Is this code unit the first of a multiple-unit sequence? Being a single, lead, or trail unit are mutually exclusive properties.
|
|
Determines whether the specified character is a letter according to Unicode 2.1.2.
|
|
Determines whether the specified UChar is a lowercase character according to Unicode 2.1.2.
|
|
Determines whether the character has the "mirrored" property. This property is set for characters that are commonly used in Right-To-Left contexts and need to be displayed with a "mirrored" glyph.
|
|
Determines whether the specified character is a printable character according to Unicode 2.1.2.
|
|
Does this code unit alone represent a Unicode code point? If so, then the code point value is the same as the code unit value, or Being a single, lead, or trail unit are mutually exclusive properties.
|
|
Determines if the specified character is a Unicode space character according to Unicode 2.1.2.
|
|
Is this code point a surrogate character? Surrogates are not characters; they are reserved for use in UTF-16 strings as leading and trailing code units of multiple-unit sequences for single code points.
|
|
Determines whether the specified character is a titlecase character according to Unicode 2.1.2.
|
|
Is this code unit one of, but not the first, of a multiple-unit sequence? Being a single, lead, or trail unit are mutually exclusive properties.
|
|
Is this code point a Unicode character? The value range for Unicode characters is limited to 0x10ffff==MAX_VALUE, and some values within this range are reserved and not characters, too. Those are the surrogate values and all values where the least significant 16 bits are either 0xfffe or 0xffff.
|
|
A convenience method for determining if a Unicode character may be part of a Unicode identifier other than the starting character. A character may be part of a Unicode identifier if and only if it is one of the following:
|
|
A convenience method for determining if a Unicode character is allowed to start in a Unicode identifier. A character may start a Unicode identifier if and only if it is a letter.
|
|
Determines whether the specified character is an uppercase character according to Unicode 2.1.2.
|
|
Is this code point a Unicode character, and not an error value? This is an efficient combination of
|
|
Determines if the specified character is white space according to ICU. A character is considered to be an ICU whitespace character if and only if it satisfies one of the following criteria:
java.lang.Character.isWhitespace() .
|
|
When writing code units for a given code point, is more than one code unit necessary? If not, then a single UChar value of Otherwise, multiple code units need to be calculated and written.
|
|
The given character is mapped to its lowercase equivalent according to Unicode 2.1.2; if the character has no lowercase equivalent, the character itself is returned. A character has a lowercase equivalent if and only if a lowercase mapping is specified for the character in the Unicode 2.0 attribute table. Unicode::toLowerCase() only deals with the general letter case conversion. For language specific case conversion behavior, use UnicodeString::toLower(). For example, the case conversion for dot-less i and dotted I in Turkish, or for final sigma in Greek.
|
|
The given character is mapped to its titlecase equivalent according to Unicode 2.1.2. There are only four Unicode characters that are truly titlecase forms that are distinct from uppercase forms. As a rule, if a character has no true titlecase equivalent, its uppercase equivalent is returned. A character has a titlecase equivalent if and only if a titlecase mapping is specified for the character in the Unicode 2.1.2 data.
|
|
The given character is mapped to its uppercase equivalent according to Unicode 2.1.2; if the character has no uppercase equivalent, the character itself is returned. Unicode::toUpperCase() only deals with the general letter case conversion. For language specific case conversion behavior, use UnicodeString::toUpper(). For example, the case conversion for dot-less i and dotted I in Turkish, or ess-zed (i.e., "sharp S") in German.
|