Class UCharacter
- All Implemented Interfaces:
UCharacterEnums.ECharacterCategory
,UCharacterEnums.ECharacterDirection
The UCharacter class provides extensions to the Character
class.
These extensions provide support for more Unicode properties.
Each ICU release supports the latest version of Unicode available at that time.
For some time before Java 5 added support for supplementary Unicode code points,
The ICU UCharacter class and many other ICU classes already supported them.
Some UCharacter methods and constants were widened slightly differently than
how the Character class methods and constants were widened later.
In particular, Character.MAX_VALUE
is still a char with the value U+FFFF,
while the MAX_VALUE
is an int with the value U+10FFFF.
Code points are represented in these API using ints. While it would be more convenient in Java to have a separate primitive datatype for them, ints suffice in the meantime.
To use this class please add the jar file name icu4j.jar to the
class path, since it contains data files which supply the information used
by this file.
E.g. In Windows
set CLASSPATH=%CLASSPATH%;$JAR_FILE_PATH/ucharacter.jar
.
Otherwise, another method would be to copy the files uprops.dat and
unames.icu from the icu4j source subdirectory
$ICU4J_SRC/src/com.ibm.icu.impl.data to your class directory
$ICU4J_CLASS/com.ibm.icu.impl.data.
Aside from the additions for UTF-16 support, and the updated Unicode properties, the main differences between UCharacter and Character are:
- UCharacter is not designed to be a char wrapper and does not have
APIs to which involves management of that single char.
These include:- char charValue(),
- int compareTo(java.lang.Character, java.lang.Character), etc.
- UCharacter does not include Character APIs that are deprecated, nor does it include the Java-specific character information, such as boolean isJavaIdentifierPart(char ch).
- Character maps characters 'A' - 'Z' and 'a' - 'z' to the numeric values '10' - '35'. UCharacter also does this in digit and getNumericValue, to adhere to the java semantics of these methods. New methods unicodeDigit, and getUnicodeNumericValue do not treat the above code points as having numeric values. This is a semantic change from ICU4J 1.3.1.
Further detail on differences can be determined using the program com.ibm.icu.dev.test.lang.UCharacterCompare
In addition to Java compatibility functions, which calculate derived properties, this API provides low-level access to the Unicode Character Database.
Unicode assigns each code point (not just assigned character) values for many properties. Most of them are simple boolean flags, or constants from a small enumerated list. For some properties, values are strings or other relatively more complex types.
For more information see "About the Unicode Character Database" (http://www.unicode.org/ucd/) and the ICU User Guide chapter on Properties (https://unicode-org.github.io/icu/userguide/strings/properties).
There are also functions that provide easy migration from C/POSIX functions like isblank(). Their use is generally discouraged because the C/POSIX standards do not define their semantics beyond the ASCII range, which means that different implementations exhibit very different behavior. Instead, Unicode properties should be used directly.
There are also only a few, broad C/POSIX character classes, and they tend to be used for conflicting purposes. For example, the "isalpha()" class is sometimes used to determine word boundaries, while a more sophisticated approach would at least distinguish initial letters from continuation characters (the latter including combining marks). (In ICU, BreakIterator is the most sophisticated API for word boundaries.) Another example: There is no "istitle()" class for titlecase characters.
ICU 3.4 and later provides API access for all twelve C/POSIX character classes. ICU implements them according to the Standard Recommendations in Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions (http://www.unicode.org/reports/tr18/#Compatibility_Properties).
API access for C/POSIX character classes is as follows:
- alpha: isUAlphabetic(c) or hasBinaryProperty(c, UProperty.ALPHABETIC)
- lower: isULowercase(c) or hasBinaryProperty(c, UProperty.LOWERCASE)
- upper: isUUppercase(c) or hasBinaryProperty(c, UProperty.UPPERCASE)
- punct: ((1<<getType(c)) & ((1<<DASH_PUNCTUATION)|(1<<START_PUNCTUATION)|
(1<<END_PUNCTUATION)|(1<<CONNECTOR_PUNCTUATION)|(1<<OTHER_PUNCTUATION)|
(1<<INITIAL_PUNCTUATION)|(1<<FINAL_PUNCTUATION)))!=0
- digit: isDigit(c) or getType(c)==DECIMAL_DIGIT_NUMBER
- xdigit: hasBinaryProperty(c, UProperty.POSIX_XDIGIT)
- alnum: hasBinaryProperty(c, UProperty.POSIX_ALNUM)
- space: isUWhiteSpace(c) or hasBinaryProperty(c, UProperty.WHITE_SPACE)
- blank: hasBinaryProperty(c, UProperty.POSIX_BLANK)
- cntrl: getType(c)==CONTROL
- graph: hasBinaryProperty(c, UProperty.POSIX_GRAPH)
- print: hasBinaryProperty(c, UProperty.POSIX_PRINT)
The C/POSIX character classes are also available in UnicodeSet patterns, using patterns like [:graph:] or \p{graph}.
There are several ICU (and Java) whitespace functions. Comparison:
- isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property; most of general categories "Z" (separators) + most whitespace ISO controls (including no-break spaces, but excluding IS1..IS4)
- isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces
- isSpaceChar: just Z (including no-break spaces)
This class is not subclassable.
- Author:
- Syn Wee Quek
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Bidi Paired Bracket Type constants.static interface
Decomposition Type constants.static interface
East Asian Width constants.static interface
Grapheme Cluster Break constants.static interface
Hangul Syllable Type constants.static interface
Indic Positional Category constants.static interface
Indic Syllabic Category constants.static interface
Joining Group constants.static interface
Joining Type constants.static interface
Line Break constants.static interface
Numeric Type constants.static interface
Sentence Break constants.static final class
. A family of character subsets representing the character blocks in the Unicode specification, generated from Unicode Data file Blocks.txt.static interface
Vertical Orientation constants.static interface
Word Break constants. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Option value for case folding: use default mappings defined in CaseFolding.txt.static final int
Option value for case folding: Use the modified set of mappings provided in CaseFolding.txt to handle dotted I and dotless i appropriately for Turkic languages (tr, az).static final int
Constant U+10FFFF, same asCharacter.MAX_CODE_POINT
.static final char
Constant U+DBFF, same asCharacter.MAX_HIGH_SURROGATE
.static final char
Constant U+DFFF, same asCharacter.MAX_LOW_SURROGATE
.static final int
Compatibility constant for Java Character's MAX_RADIX.static final char
Constant U+DFFF, same asCharacter.MAX_SURROGATE
.static final int
The highest Unicode code point value (scalar value), constant U+10FFFF (uses 21 bits).static final int
Constant U+0000, same asCharacter.MIN_CODE_POINT
.static final char
Constant U+D800, same asCharacter.MIN_HIGH_SURROGATE
.static final char
Constant U+DC00, same asCharacter.MIN_LOW_SURROGATE
.static final int
Compatibility constant for Java Character's MIN_RADIX.static final int
Constant U+10000, same asCharacter.MIN_SUPPLEMENTARY_CODE_POINT
.static final char
Constant U+D800, same asCharacter.MIN_SURROGATE
.static final int
The lowest Unicode code point value, constant 0.static final double
Special value that is returned by getUnicodeNumericValue(int) when no numeric value is defined for a code point.static final int
Unicode value used when translating into Unicode encoding form and there is no existing character.static final int
The minimum value for Supplementary code points, constant U+10000.static final int
Do not adjust the titlecasing indexes from BreakIterator::next() indexes; titlecase exactly the characters at breaks from the iterator.static final int
Do not lowercase non-initial parts of words when titlecasing.Fields inherited from interface com.ibm.icu.lang.UCharacterEnums.ECharacterCategory
CHAR_CATEGORY_COUNT, COMBINING_SPACING_MARK, CONNECTOR_PUNCTUATION, CONTROL, CURRENCY_SYMBOL, DASH_PUNCTUATION, DECIMAL_DIGIT_NUMBER, ENCLOSING_MARK, END_PUNCTUATION, FINAL_PUNCTUATION, FINAL_QUOTE_PUNCTUATION, FORMAT, GENERAL_OTHER_TYPES, INITIAL_PUNCTUATION, 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
Fields inherited from interface com.ibm.icu.lang.UCharacterEnums.ECharacterDirection
ARABIC_NUMBER, BLOCK_SEPARATOR, BOUNDARY_NEUTRAL, CHAR_DIRECTION_COUNT, COMMON_NUMBER_SEPARATOR, DIR_NON_SPACING_MARK, DIRECTIONALITY_ARABIC_NUMBER, DIRECTIONALITY_BOUNDARY_NEUTRAL, DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, DIRECTIONALITY_EUROPEAN_NUMBER, DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR, DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, DIRECTIONALITY_LEFT_TO_RIGHT, DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING, DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, DIRECTIONALITY_NONSPACING_MARK, DIRECTIONALITY_OTHER_NEUTRALS, DIRECTIONALITY_PARAGRAPH_SEPARATOR, DIRECTIONALITY_POP_DIRECTIONAL_FORMAT, DIRECTIONALITY_RIGHT_TO_LEFT, DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC, DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE, DIRECTIONALITY_SEGMENT_SEPARATOR, DIRECTIONALITY_UNDEFINED, DIRECTIONALITY_WHITESPACE, EUROPEAN_NUMBER, EUROPEAN_NUMBER_SEPARATOR, EUROPEAN_NUMBER_TERMINATOR, FIRST_STRONG_ISOLATE, LEFT_TO_RIGHT, LEFT_TO_RIGHT_EMBEDDING, LEFT_TO_RIGHT_ISOLATE, LEFT_TO_RIGHT_OVERRIDE, OTHER_NEUTRAL, POP_DIRECTIONAL_FORMAT, POP_DIRECTIONAL_ISOLATE, RIGHT_TO_LEFT, RIGHT_TO_LEFT_ARABIC, RIGHT_TO_LEFT_EMBEDDING, RIGHT_TO_LEFT_ISOLATE, RIGHT_TO_LEFT_OVERRIDE, SEGMENT_SEPARATOR, WHITE_SPACE_NEUTRAL
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
charCount
(int cp) Same asCharacter.charCount(int)
.static final int
codePointAt
(char[] text, int index) Same asCharacter.codePointAt(char[], int)
.static final int
codePointAt
(char[] text, int index, int limit) static final int
codePointAt
(CharSequence seq, int index) static final int
codePointBefore
(char[] text, int index) static final int
codePointBefore
(char[] text, int index, int limit) static final int
codePointBefore
(CharSequence seq, int index) static int
codePointCount
(char[] text, int start, int limit) Equivalent to theCharacter.codePointCount(char[], int, int)
method, for convenience.static int
codePointCount
(CharSequence text, int start, int limit) Equivalent to theCharacter.codePointCount(CharSequence, int, int)
method, for convenience.static int
digit
(int ch) Returnss the numeric value of a decimal digit code point.static int
digit
(int ch, int radix) Returnss the numeric value of a decimal digit code point.static int
foldCase
(int ch, boolean defaultmapping) 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.static int
foldCase
(int ch, int 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.static String
The given string is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if any character has no case folding equivalent, the character itself is returned.static final String
The given string is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if any character has no case folding equivalent, the character itself is returned.static char
forDigit
(int digit, int radix) Provide the java.lang.Character forDigit API, for convenience.static VersionInfo
getAge
(int ch) Returns the "age" of the code point.static int
getBidiPairedBracket
(int c) Maps the specified character to its paired bracket character.static int
static int
getCharFromName
(String name) static int
getCharFromName1_0
(String name) Deprecated.ICU 49static int
getCharFromNameAlias
(String name) static int
getCodePoint
(char char16) Returns the code point corresponding to the BMP code point.static int
getCodePoint
(int lead, int trail) Returns a code point corresponding to the two surrogate code units.static int
getCombiningClass
(int ch) Returns the combining class of the argument codepointstatic int
getDirection
(int ch) Returns the Bidirection property of a code point.static byte
getDirectionality
(int cp) Equivalent to theCharacter.getDirectionality(char)
method, for convenience.static String
getExtendedName
(int ch) Returns a name for a valid codepoint.static ValueIterator
static int
getHanNumericValue
(int ch) Returns the numeric value of a Han character.static int
getIntPropertyMaxValue
(int type) Returns the maximum value for an integer/binary Unicode property.static int
getIntPropertyMinValue
(int type) Returns the minimum value for an integer/binary Unicode property type.static int
getIntPropertyValue
(int ch, int type) Returns the property value for a Unicode property type of a code point.static String
getISOComment
(int ch) Deprecated.ICU 49static int
getMirror
(int ch) Maps the specified code point to a "mirror-image" code point.static String
getName
(int ch) Returns the most current Unicode name of the argument code point, or null if the character is unassigned or outside the rangeUCharacter.MIN_VALUE
andUCharacter.MAX_VALUE
or does not have a name.static String
Returns the names for each of the characters in a stringstatic String
getName1_0
(int ch) Deprecated.ICU 49static ValueIterator
Deprecated.ICU 49static String
getNameAlias
(int ch) Returns the corrected name from NameAliases.txt if there is one.static ValueIterator
static int
getNumericValue
(int ch) Returns the numeric value of the code point as a nonnegative integer.static int
getPropertyEnum
(CharSequence propertyAlias) Return the UProperty selector for a given property name, as specified in the Unicode database file PropertyAliases.txt.static String
getPropertyName
(int property, int nameChoice) Return the Unicode name for a given property, as given in the Unicode database file PropertyAliases.txt.static int
getPropertyValueEnum
(int property, CharSequence valueAlias) Return the property value integer for a given value name, as specified in the Unicode database file PropertyValueAliases.txt.static int
getPropertyValueEnumNoThrow
(int property, CharSequence valueAlias) Deprecated.This API is ICU internal only.static String
getPropertyValueName
(int property, int value, int nameChoice) Return the Unicode name for a given property value, as given in the Unicode database file PropertyValueAliases.txt.static String
getStringPropertyValue
(int propertyEnum, int codepoint, int nameChoice) Deprecated.This API is ICU internal only.static int
getType
(int ch) Returns a value indicating a code point's Unicode category.static RangeValueIterator
static double
getUnicodeNumericValue
(int ch) Returns the numeric value for a Unicode code point as defined in the Unicode Character Database.static VersionInfo
Returns the version of Unicode data used.static boolean
hasBinaryProperty
(int ch, int property) Check a binary Unicode property for a code point.static boolean
hasBinaryProperty
(CharSequence s, int property) Returns true if the property is true for the string.static boolean
isBaseForm
(int ch) Determines whether the specified code point is of base form.static boolean
isBMP
(int ch) Determines if the code point is in the BMP plane.static boolean
isDefined
(int ch) Determines if a code point has a defined meaning in the up-to-date Unicode standard.static boolean
isDigit
(int ch) Determines if a code point is a Java digit.static boolean
isHighSurrogate
(int codePoint) Same asCharacter.isHighSurrogate(char)
, except that the ICU version acceptsint
for code points.static boolean
isIdentifierIgnorable
(int ch) Determines if the specified code point should be regarded as an ignorable character in a Java identifier.static boolean
isISOControl
(int ch) Determines if the specified code point is an ISO control character.static boolean
isJavaIdentifierPart
(int cp) Compatibility override of Java method, delegates to java.lang.Character.isJavaIdentifierPart.static boolean
isJavaIdentifierStart
(int cp) Compatibility override of Java method, delegates to java.lang.Character.isJavaIdentifierStart.static boolean
isJavaLetter
(int cp) Deprecated.ICU 3.4 (Java)static boolean
isJavaLetterOrDigit
(int cp) Deprecated.ICU 3.4 (Java)static boolean
isLegal
(int ch) A code point is illegal if and only if Out of bounds, less than 0 or greater than UCharacter.MAX_VALUE A surrogate value, 0xD800 to 0xDFFF Not-a-character, having the form 0x xxFFFF or 0x xxFFFE Note: legal does not mean that it is assigned in this version of Unicode.static boolean
A string is legal iff all its code points are legal.static boolean
isLetter
(int ch) Determines if the specified code point is a letter.static boolean
isLetterOrDigit
(int ch) Determines if the specified code point is a letter or digit.static boolean
isLowerCase
(int ch) Determines if the specified code point is a lowercase character.static boolean
isLowSurrogate
(int codePoint) Same asCharacter.isLowSurrogate(char)
, except that the ICU version acceptsint
for code points.static boolean
isMirrored
(int ch) Determines whether the code point has the "mirrored" property.static boolean
isPrintable
(int ch) Determines whether the specified code point is a printable character according to the Unicode standard.static boolean
isSpace
(int ch) Deprecated.ICU 3.4 (Java)static boolean
isSpaceChar
(int ch) Determines if the specified code point is a Unicode specified space character, i.e. if code point is in the category Zs, Zl and Zp.static boolean
isSupplementary
(int ch) Determines if the code point is a supplementary character.static final boolean
isSupplementaryCodePoint
(int cp) static final boolean
isSurrogatePair
(int high, int low) Same asCharacter.isSurrogatePair(char, char)
, except that the ICU version acceptsint
for code points.static boolean
isTitleCase
(int ch) Determines if the specified code point is a titlecase character.static boolean
isUAlphabetic
(int ch) static boolean
isULowercase
(int ch) static boolean
isUnicodeIdentifierPart
(int ch) Determines if the specified character is permissible as a non-initial character of an identifier according to UAX #31 Unicode Identifier and Pattern Syntax.static boolean
isUnicodeIdentifierStart
(int ch) Determines if the specified character is permissible as the first character in an identifier according to UAX #31 Unicode Identifier and Pattern Syntax.static boolean
isUpperCase
(int ch) Determines if the specified code point is an uppercase character.static boolean
isUUppercase
(int ch) static boolean
isUWhiteSpace
(int ch) static final boolean
isValidCodePoint
(int cp) Equivalent toCharacter.isValidCodePoint(int)
.static boolean
isWhitespace
(int ch) Determines if the specified code point is a white space character.static int
offsetByCodePoints
(char[] text, int start, int count, int index, int codePointOffset) Equivalent to theCharacter.offsetByCodePoints(char[], int, int, int, int)
method, for convenience.static int
offsetByCodePoints
(CharSequence text, int index, int codePointOffset) Equivalent to theCharacter.offsetByCodePoints(CharSequence, int, int)
method, for convenience.static final char[]
toChars
(int cp) Same asCharacter.toChars(int)
.static final int
toChars
(int cp, char[] dst, int dstIndex) Same asCharacter.toChars(int, char[], int)
.static final int
toCodePoint
(int high, int low) Same asCharacter.toCodePoint(char, char)
, except that the ICU version acceptsint
for code points.static int
toLowerCase
(int ch) The given code point is mapped to its lowercase equivalent; if the code point has no lowercase equivalent, the code point itself is returned.static String
toLowerCase
(ULocale locale, String str) Returns the lowercase version of the argument string.static String
toLowerCase
(String str) Returns the lowercase version of the argument string.static String
toLowerCase
(Locale locale, String str) Returns the lowercase version of the argument string.static String
toString
(int ch) Converts argument code point and returns a String object representing the code point's value in UTF-16 format.static int
toTitleCase
(int ch) Converts the code point argument to titlecase.static String
toTitleCase
(ULocale locale, String str, BreakIterator titleIter) Returns the titlecase version of the argument string.static String
toTitleCase
(ULocale locale, String str, BreakIterator titleIter, int options) Returns the titlecase version of the argument string.static String
toTitleCase
(String str, BreakIterator breakiter) Returns the titlecase version of the argument string.static String
toTitleCase
(Locale locale, String str, BreakIterator breakiter) Returns the titlecase version of the argument string.static String
toTitleCase
(Locale locale, String str, BreakIterator titleIter, int options) static int
toUpperCase
(int ch) Converts the character argument to uppercase.static String
toUpperCase
(ULocale locale, String str) Returns the uppercase version of the argument string.static String
toUpperCase
(String str) Returns the uppercase version of the argument string.static String
toUpperCase
(Locale locale, String str) Returns the uppercase version of the argument string.
-
Field Details
-
MIN_VALUE
public static final int MIN_VALUEThe lowest Unicode code point value, constant 0. Same asCharacter.MIN_CODE_POINT
, same integer value asCharacter.MIN_VALUE
.- See Also:
-
MAX_VALUE
public static final int MAX_VALUEThe highest Unicode code point value (scalar value), constant U+10FFFF (uses 21 bits). Same asCharacter.MAX_CODE_POINT
.Up-to-date Unicode implementation of
Character.MAX_VALUE
which is still a char with the value U+FFFF.- See Also:
-
SUPPLEMENTARY_MIN_VALUE
public static final int SUPPLEMENTARY_MIN_VALUEThe minimum value for Supplementary code points, constant U+10000. Same asCharacter.MIN_SUPPLEMENTARY_CODE_POINT
.- See Also:
-
REPLACEMENT_CHAR
public static final int REPLACEMENT_CHARUnicode value used when translating into Unicode encoding form and there is no existing character.- See Also:
-
NO_NUMERIC_VALUE
public static final double NO_NUMERIC_VALUESpecial value that is returned by getUnicodeNumericValue(int) when no numeric value is defined for a code point.- See Also:
-
MIN_RADIX
public static final int MIN_RADIXCompatibility constant for Java Character's MIN_RADIX.- See Also:
-
MAX_RADIX
public static final int MAX_RADIXCompatibility constant for Java Character's MAX_RADIX.- See Also:
-
TITLECASE_NO_LOWERCASE
public static final int TITLECASE_NO_LOWERCASEDo not lowercase non-initial parts of words when titlecasing. Option bit for titlecasing APIs that take an options bit set. By default, titlecasing will titlecase the first cased character of a word and lowercase all other characters. With this option, the other characters will not be modified.- See Also:
-
TITLECASE_NO_BREAK_ADJUSTMENT
public static final int TITLECASE_NO_BREAK_ADJUSTMENTDo not adjust the titlecasing indexes from BreakIterator::next() indexes; titlecase exactly the characters at breaks from the iterator. Option bit for titlecasing APIs that take an options bit set. By default, titlecasing will take each break iterator index, adjust it by looking for the next cased character, and titlecase that one. Other characters are lowercased. This follows Unicode 4 & 5 section 3.13 Default Case Operations: R3 toTitlecase(X): Find the word boundaries based on Unicode Standard Annex #29, "Text Boundaries." Between each pair of word boundaries, find the first cased character F. If F exists, map F to default_title(F); then map each subsequent character C to default_lower(C).- See Also:
-
FOLD_CASE_DEFAULT
public static final int FOLD_CASE_DEFAULTOption value for case folding: use default mappings defined in CaseFolding.txt.- See Also:
-
FOLD_CASE_EXCLUDE_SPECIAL_I
public static final int FOLD_CASE_EXCLUDE_SPECIAL_IOption value for case folding: Use the modified set of mappings provided in CaseFolding.txt to handle dotted I and dotless i appropriately for Turkic languages (tr, az).Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that are to be included for default mappings and excluded for the Turkic-specific mappings.
Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that are to be excluded for default mappings and included for the Turkic-specific mappings.
- See Also:
-
MIN_HIGH_SURROGATE
public static final char MIN_HIGH_SURROGATEConstant U+D800, same asCharacter.MIN_HIGH_SURROGATE
.- See Also:
-
MAX_HIGH_SURROGATE
public static final char MAX_HIGH_SURROGATEConstant U+DBFF, same asCharacter.MAX_HIGH_SURROGATE
.- See Also:
-
MIN_LOW_SURROGATE
public static final char MIN_LOW_SURROGATEConstant U+DC00, same asCharacter.MIN_LOW_SURROGATE
.- See Also:
-
MAX_LOW_SURROGATE
public static final char MAX_LOW_SURROGATEConstant U+DFFF, same asCharacter.MAX_LOW_SURROGATE
.- See Also:
-
MIN_SURROGATE
public static final char MIN_SURROGATEConstant U+D800, same asCharacter.MIN_SURROGATE
.- See Also:
-
MAX_SURROGATE
public static final char MAX_SURROGATEConstant U+DFFF, same asCharacter.MAX_SURROGATE
.- See Also:
-
MIN_SUPPLEMENTARY_CODE_POINT
public static final int MIN_SUPPLEMENTARY_CODE_POINTConstant U+10000, same asCharacter.MIN_SUPPLEMENTARY_CODE_POINT
.- See Also:
-
MAX_CODE_POINT
public static final int MAX_CODE_POINTConstant U+10FFFF, same asCharacter.MAX_CODE_POINT
.- See Also:
-
MIN_CODE_POINT
public static final int MIN_CODE_POINTConstant U+0000, same asCharacter.MIN_CODE_POINT
.- See Also:
-
-
Method Details
-
digit
public static int digit(int ch, int radix) Returnss the numeric value of a decimal digit code point.
This method observes the semantics ofjava.lang.Character.digit()
. Note that this will return positive values for code points for which isDigit returns false, just like java.lang.Character.
Semantic Change: In release 1.3.1 and prior, this did not treat the European letters as having a digit value, and also treated numeric letters and other numbers as digits. This has been changed to conform to the java semantics.
A code point is a valid digit if and only if:- ch is a decimal digit or one of the european letters, and
- the value of ch is less than the specified radix.
- Parameters:
ch
- the code point to queryradix
- the radix- Returns:
- the numeric value represented by the code point in the specified radix, or -1 if the code point is not a decimal digit or if its value is too large for the radix
-
digit
public static int digit(int ch) Returnss the numeric value of a decimal digit code point.
This is a convenience overload ofdigit(int, int)
that provides a decimal radix.
Semantic Change: In release 1.3.1 and prior, this treated numeric letters and other numbers as digits. This has been changed to conform to the java semantics.- Parameters:
ch
- the code point to query- Returns:
- the numeric value represented by the code point, or -1 if the code point is not a decimal digit or if its value is too large for a decimal radix
-
getNumericValue
public static int getNumericValue(int ch) Returns the numeric value of the code point as a nonnegative integer.
If the code point does not have a numeric value, then -1 is returned.
If the code point has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.- Parameters:
ch
- the code point to query- Returns:
- the numeric value of the code point, or -1 if it has no numeric value, or -2 if it has a numeric value that cannot be represented as a nonnegative integer
-
getUnicodeNumericValue
public static double getUnicodeNumericValue(int ch) Returns the numeric value for a Unicode code point as defined in the Unicode Character Database.A "double" return type is necessary because some numeric values are fractions, negative, or too large for int.
For characters without any numeric values in the Unicode Character Database, this function will return NO_NUMERIC_VALUE. Note: This is different from the Unicode Standard which specifies NaN as the default value.
API Change: In release 2.2 and prior, this API has a return type int and returns -1 when the argument ch does not have a corresponding numeric value. This has been changed to synch with ICU4C This corresponds to the ICU4C function u_getNumericValue.
- Parameters:
ch
- Code point to get the numeric value for.- Returns:
- numeric value of ch, or NO_NUMERIC_VALUE if none is defined.
-
isSpace
Deprecated.ICU 3.4 (Java)Compatibility override of Java deprecated method. This method will always remain deprecated. Same as java.lang.Character.isSpace().- Parameters:
ch
- the code point- Returns:
- true if the code point is a space character as defined by java.lang.Character.isSpace.
-
getType
public static int getType(int ch) Returns a value indicating a code point's Unicode category. Up-to-date Unicode implementation of java.lang.Character.getType() except for the above mentioned code points that had their category changed.
Return results are constants from the interface UCharacterCategory
NOTE: the UCharacterCategory values are not compatible with those returned by java.lang.Character.getType. UCharacterCategory values match the ones used in ICU4C, while java.lang.Character type values, though similar, skip the value 17.- Parameters:
ch
- code point whose type is to be determined- Returns:
- category which is a value of UCharacterCategory
-
isDefined
public static boolean isDefined(int ch) Determines if a code point has a defined meaning in the up-to-date Unicode standard. E.g. supplementary code points though allocated space are not defined in Unicode yet.
Up-to-date Unicode implementation of java.lang.Character.isDefined()- Parameters:
ch
- code point to be determined if it is defined in the most current version of Unicode- Returns:
- true if this code point is defined in unicode
-
isDigit
public static boolean isDigit(int ch) Determines if a code point is a Java digit.
This method observes the semantics ofjava.lang.Character.isDigit()
. It returns true for decimal digits only.
Semantic Change: In release 1.3.1 and prior, this treated numeric letters and other numbers as digits. This has been changed to conform to the java semantics.- Parameters:
ch
- code point to query- Returns:
- true if this code point is a digit
-
isISOControl
public static boolean isISOControl(int ch) Determines if the specified code point is an ISO control character. A code point is considered to be an ISO control character if it is in the range \u0000 through \u001F or in the range \u007F through \u009F.
Up-to-date Unicode implementation of java.lang.Character.isISOControl()- Parameters:
ch
- code point to determine if it is an ISO control character- Returns:
- true if code point is a ISO control character
-
isLetter
public static boolean isLetter(int ch) Determines if the specified code point is a letter. Up-to-date Unicode implementation of java.lang.Character.isLetter()- Parameters:
ch
- code point to determine if it is a letter- Returns:
- true if code point is a letter
-
isLetterOrDigit
public static boolean isLetterOrDigit(int ch) Determines if the specified code point is a letter or digit. This method, unlike java.lang.Character does not regard the ascii characters 'A' - 'Z' and 'a' - 'z' as digits.- Parameters:
ch
- code point to determine if it is a letter or a digit- Returns:
- true if code point is a letter or a digit
-
isJavaLetter
Deprecated.ICU 3.4 (Java)Compatibility override of Java deprecated method. This method will always remain deprecated. Delegates to java.lang.Character.isJavaIdentifierStart.- Parameters:
cp
- the code point- Returns:
- true if the code point can start a java identifier.
-
isJavaLetterOrDigit
Deprecated.ICU 3.4 (Java)Compatibility override of Java deprecated method. This method will always remain deprecated. Delegates to java.lang.Character.isJavaIdentifierPart.- Parameters:
cp
- the code point- Returns:
- true if the code point can continue a java identifier.
-
isJavaIdentifierStart
public static boolean isJavaIdentifierStart(int cp) Compatibility override of Java method, delegates to java.lang.Character.isJavaIdentifierStart.- Parameters:
cp
- the code point- Returns:
- true if the code point can start a java identifier.
-
isJavaIdentifierPart
public static boolean isJavaIdentifierPart(int cp) Compatibility override of Java method, delegates to java.lang.Character.isJavaIdentifierPart.- Parameters:
cp
- the code point- Returns:
- true if the code point can continue a java identifier.
-
isLowerCase
public static boolean isLowerCase(int ch) Determines if the specified code point is a lowercase character. UnicodeData only contains case mappings for code points where they are one-to-one mappings; it also omits information about context-sensitive case mappings.
For more information about Unicode case mapping please refer to the Technical report #21.
Up-to-date Unicode implementation of java.lang.Character.isLowerCase()- Parameters:
ch
- code point to determine if it is in lowercase- Returns:
- true if code point is a lowercase character
-
isWhitespace
public static boolean isWhitespace(int ch) Determines if the specified code point is a white space character. A code point is considered to be an whitespace character if and only if it satisfies one of the following criteria:- It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not also a non-breaking space (\u00A0 or \u2007 or \u202F).
- It is \u0009, HORIZONTAL TABULATION.
- It is \u000A, LINE FEED.
- It is \u000B, VERTICAL TABULATION.
- It is \u000C, FORM FEED.
- It is \u000D, CARRIAGE RETURN.
- It is \u001C, FILE SEPARATOR.
- It is \u001D, GROUP SEPARATOR.
- It is \u001E, RECORD SEPARATOR.
- It is \u001F, UNIT SEPARATOR.
Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs) to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false. See http://www.unicode.org/versions/Unicode4.0.1/
- Parameters:
ch
- code point to determine if it is a white space- Returns:
- true if the specified code point is a white space character
-
isSpaceChar
public static boolean isSpaceChar(int ch) Determines if the specified code point is a Unicode specified space character, i.e. if code point is in the category Zs, Zl and Zp. Up-to-date Unicode implementation of java.lang.Character.isSpaceChar().- Parameters:
ch
- code point to determine if it is a space- Returns:
- true if the specified code point is a space character
-
isTitleCase
public static boolean isTitleCase(int ch) Determines if the specified code point is a titlecase character. UnicodeData only contains case mappings for code points where they are one-to-one mappings; it also omits information about context-sensitive case mappings.
For more information about Unicode case mapping please refer to the Technical report #21.
Up-to-date Unicode implementation of java.lang.Character.isTitleCase().- Parameters:
ch
- code point to determine if it is in title case- Returns:
- true if the specified code point is a titlecase character
-
isUnicodeIdentifierPart
public static boolean isUnicodeIdentifierPart(int ch) Determines if the specified character is permissible as a non-initial character of an identifier according to UAX #31 Unicode Identifier and Pattern Syntax.Same as Unicode ID_Continue (
UProperty.ID_CONTINUE
).Note that this differs from
Character.isUnicodeIdentifierPart(char)
which implements a different identifier profile.- Parameters:
ch
- the code point to be tested- Returns:
- true if the code point may occur as a non-initial character of an identifier
-
isUnicodeIdentifierStart
public static boolean isUnicodeIdentifierStart(int ch) Determines if the specified character is permissible as the first character in an identifier according to UAX #31 Unicode Identifier and Pattern Syntax.Same as Unicode ID_Start (
UProperty.ID_START
).Note that this differs from
Character.isUnicodeIdentifierStart(char)
which implements a different identifier profile.- Parameters:
ch
- the code point to be tested- Returns:
- true if the code point may start an identifier
-
isIdentifierIgnorable
public static boolean isIdentifierIgnorable(int ch) Determines if the specified code point should be regarded as an ignorable character in a Java identifier. A character is Java-identifier-ignorable if it has the general category Cf Formatting Control, or it is a non-Java-whitespace ISO control: U+0000..U+0008, U+000E..U+001B, U+007F..U+009F.
Up-to-date Unicode implementation of java.lang.Character.isIdentifierIgnorable().
See UTR #8.Note that Unicode just recommends to ignore Cf (format controls).
- Parameters:
ch
- code point to be determined if it can be ignored in a Unicode identifier.- Returns:
- true if the code point is ignorable
-
isUpperCase
public static boolean isUpperCase(int ch) Determines if the specified code point is an uppercase character. UnicodeData only contains case mappings for code point where they are one-to-one mappings; it also omits information about context-sensitive case mappings.
For language specific case conversion behavior, use toUpperCase(locale, str).
For example, the case conversion for dot-less i and dotted I in Turkish, or for final sigma in Greek. For more information about Unicode case mapping please refer to the Technical report #21.
Up-to-date Unicode implementation of java.lang.Character.isUpperCase().- Parameters:
ch
- code point to determine if it is in uppercase- Returns:
- true if the code point is an uppercase character
-
toLowerCase
public static int toLowerCase(int ch) The given code point is mapped to its lowercase equivalent; if the code point has no lowercase equivalent, the code point itself is returned. Up-to-date Unicode implementation of java.lang.Character.toLowerCase()This function only returns the simple, single-code point case mapping. Full case mappings should be used whenever possible because they produce better results by working on whole strings. They take into account the string context and the language and can map to a result string with a different length as appropriate. Full case mappings are applied by the case mapping functions that take String parameters rather than code points (int). See also the User Guide chapter on C/POSIX migration: https://unicode-org.github.io/icu/userguide/icu/posix#case-mappings
- Parameters:
ch
- code point whose lowercase equivalent is to be retrieved- Returns:
- the lowercase equivalent code point
-
toString
Converts argument code point and returns a String object representing the code point's value in UTF-16 format. The result is a string whose length is 1 for BMP code points, 2 for supplementary ones.Up-to-date Unicode implementation of java.lang.Character.toString().
- Parameters:
ch
- code point- Returns:
- string representation of the code point, null if code point is not defined in unicode
-
toTitleCase
public static int toTitleCase(int ch) Converts the code point argument to titlecase. If no titlecase is available, the uppercase is returned. If no uppercase is available, the code point itself is returned. Up-to-date Unicode implementation of java.lang.Character.toTitleCase()This function only returns the simple, single-code point case mapping. Full case mappings should be used whenever possible because they produce better results by working on whole strings. They take into account the string context and the language and can map to a result string with a different length as appropriate. Full case mappings are applied by the case mapping functions that take String parameters rather than code points (int). See also the User Guide chapter on C/POSIX migration: https://unicode-org.github.io/icu/userguide/icu/posix#case-mappings
- Parameters:
ch
- code point whose title case is to be retrieved- Returns:
- titlecase code point
-
toUpperCase
public static int toUpperCase(int ch) Converts the character argument to uppercase. If no uppercase is available, the character itself is returned. Up-to-date Unicode implementation of java.lang.Character.toUpperCase()This function only returns the simple, single-code point case mapping. Full case mappings should be used whenever possible because they produce better results by working on whole strings. They take into account the string context and the language and can map to a result string with a different length as appropriate. Full case mappings are applied by the case mapping functions that take String parameters rather than code points (int). See also the User Guide chapter on C/POSIX migration: https://unicode-org.github.io/icu/userguide/icu/posix#case-mappings
- Parameters:
ch
- code point whose uppercase is to be retrieved- Returns:
- uppercase code point
-
isSupplementary
public static boolean isSupplementary(int ch) Determines if the code point is a supplementary character. A code point is a supplementary character if and only if it is greater than SUPPLEMENTARY_MIN_VALUE- Parameters:
ch
- code point to be determined if it is in the supplementary plane- Returns:
- true if code point is a supplementary character
-
isBMP
public static boolean isBMP(int ch) Determines if the code point is in the BMP plane.- Parameters:
ch
- code point to be determined if it is not a supplementary character- Returns:
- true if code point is not a supplementary character
-
isPrintable
public static boolean isPrintable(int ch) Determines whether the specified code point is a printable character according to the Unicode standard.- Parameters:
ch
- code point to be determined if it is printable- Returns:
- true if the code point is a printable character
-
isBaseForm
public static boolean isBaseForm(int ch) Determines whether the specified code point is of base form. A code point of base form does not graphically combine with preceding characters, and is neither a control nor a format character.- Parameters:
ch
- code point to be determined if it is of base form- Returns:
- true if the code point is of base form
-
getDirection
public static int getDirection(int ch) Returns the Bidirection property of a code point. For example, 0x0041 (letter A) has the LEFT_TO_RIGHT directional property.
Result returned belongs to the interface UCharacterDirection- Parameters:
ch
- the code point to be determined its direction- Returns:
- direction constant from UCharacterDirection.
-
isMirrored
public static boolean isMirrored(int ch) Determines whether the code point 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.- Parameters:
ch
- code point whose mirror is to be determined- Returns:
- true if the code point has the "mirrored" property
-
getMirror
public static int getMirror(int ch) Maps the specified code point to a "mirror-image" code point. For code points with the "mirrored" property, implementations sometimes need a "poor man's" mapping to another code point such that the default glyph may serve as the mirror-image of the default glyph of the specified code point.
This is useful for text conversion to and from codepages with visual order, and for displays without glyph selection capabilities.- Parameters:
ch
- code point whose mirror is to be retrieved- Returns:
- another code point that may serve as a mirror-image substitute, or ch itself if there is no such mapping or ch does not have the "mirrored" property
-
getBidiPairedBracket
public static int getBidiPairedBracket(int c) Maps the specified character to its paired bracket character. For Bidi_Paired_Bracket_Type!=None, this is the same as getMirror(int). Otherwise c itself is returned. See http://www.unicode.org/reports/tr9/- Parameters:
c
- the code point to be mapped- Returns:
- the paired bracket code point, or c itself if there is no such mapping (Bidi_Paired_Bracket_Type=None)
- See Also:
-
getCombiningClass
public static int getCombiningClass(int ch) Returns the combining class of the argument codepoint- Parameters:
ch
- code point whose combining is to be retrieved- Returns:
- the combining class of the codepoint
-
isLegal
public static boolean isLegal(int ch) A code point is illegal if and only if- Out of bounds, less than 0 or greater than UCharacter.MAX_VALUE
- A surrogate value, 0xD800 to 0xDFFF
- Not-a-character, having the form 0x xxFFFF or 0x xxFFFE
- Parameters:
ch
- code point to determine if it is a legal code point by itself- Returns:
- true if and only if legal.
-
isLegal
A string is legal iff all its code points are legal. A code point is illegal if and only if- Out of bounds, less than 0 or greater than UCharacter.MAX_VALUE
- A surrogate value, 0xD800 to 0xDFFF
- Not-a-character, having the form 0x xxFFFF or 0x xxFFFE
- Parameters:
str
- containing code points to examin- Returns:
- true if and only if legal.
-
getUnicodeVersion
Returns the version of Unicode data used.- Returns:
- the unicode version number used
-
getName
Returns the most current Unicode name of the argument code point, or null if the character is unassigned or outside the rangeUCharacter.MIN_VALUE
andUCharacter.MAX_VALUE
or does not have a name.
Note calling any methods related to code point names, e.g.getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
ch
- the code point for which to get the name- Returns:
- most current Unicode name
-
getName
Returns the names for each of the characters in a string- Parameters:
s
- string to formatseparator
- string to go between names- Returns:
- string of names
-
getName1_0
Deprecated.ICU 49Returns null. Used to return the Unicode_1_Name property value which was of little practical value.- Parameters:
ch
- the code point for which to get the name- Returns:
- null
-
getExtendedName
Returns a name for a valid codepoint. Unlike, getName(int) and getName1_0(int), this method will return a name even for codepoints that are not assigned a name in UnicodeData.txt.The names are returned in the following order.
- Most current Unicode name if there is any
- Unicode 1.0 name if there is any
- Extended name in the form of "<codepoint_type-codepoint_hex_digits>". E.g., <noncharacter-fffe>
getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
ch
- the code point for which to get the name- Returns:
- a name for the argument codepoint
-
getNameAlias
Returns the corrected name from NameAliases.txt if there is one. Returns null if the character is unassigned or outside the range UCharacter.MIN_VALUE and UCharacter.MAX_VALUE or does not have a name.
Note calling any methods related to code point names, e.g.getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
ch
- the code point for which to get the name alias- Returns:
- Unicode name alias, or null
-
getISOComment
Deprecated.ICU 49Returns null. Used to return the ISO 10646 comment for a character. The Unicode ISO_Comment property is deprecated and has no values.- Parameters:
ch
- The code point for which to get the ISO comment. It must be the case that0 <= ch <= 0x10ffff
.- Returns:
- null
-
getCharFromName
Finds a Unicode code point by its most current Unicode name and return its code point value. All Unicode names are in uppercase. Note calling any methods related to code point names, e.g.
getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
name
- most current Unicode character name whose code point is to be returned- Returns:
- code point or -1 if name is not found
-
getCharFromName1_0
Deprecated.ICU 49Returns -1.Used to find a Unicode character by its version 1.0 Unicode name and return its code point value.
- Parameters:
name
- Unicode 1.0 code point name whose code point is to be returned- Returns:
- -1
- See Also:
-
getCharFromExtendedName
Find a Unicode character by either its name and return its code point value. All Unicode names are in uppercase. Extended names are all lowercase except for numbers and are contained within angle brackets. The names are searched in the following order
- Most current Unicode name if there is any
- Unicode 1.0 name if there is any
- Extended name in the form of "<codepoint_type-codepoint_hex_digits>". E.g. <noncharacter-FFFE>
getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
name
- codepoint name- Returns:
- code point associated with the name or -1 if the name is not found.
-
getCharFromNameAlias
Find a Unicode character by its corrected name alias and return its code point value. All Unicode names are in uppercase. Note calling any methods related to code point names, e.g.
getName()
incurs a one-time initialization cost to construct the name tables.- Parameters:
name
- Unicode name alias whose code point is to be returned- Returns:
- code point or -1 if name is not found
-
getPropertyName
Return the Unicode name for a given property, as given in the Unicode database file PropertyAliases.txt. Most properties have more than one name. The nameChoice determines which one is returned. In addition, this function maps the property UProperty.GENERAL_CATEGORY_MASK to the synthetic names "gcm" / "General_Category_Mask". These names are not in PropertyAliases.txt.- Parameters:
property
- UProperty selector.nameChoice
- UProperty.NameChoice selector for which name to get. All properties have a long name. Most have a short name, but some do not. Unicode allows for additional names; if present these will be returned by UProperty.NameChoice.LONG + i, where i=1, 2,...- Returns:
- a name, or null if Unicode explicitly defines no name ("n/a") for a given property/nameChoice. If a given nameChoice throws an exception, then all larger values of nameChoice will throw an exception. If null is returned for a given nameChoice, then other nameChoice values may return non-null results.
- Throws:
IllegalArgumentException
- thrown if property or nameChoice are invalid.- See Also:
-
getPropertyEnum
Return the UProperty selector for a given property name, as specified in the Unicode database file PropertyAliases.txt. Short, long, and any other variants are recognized. In addition, this function maps the synthetic names "gcm" / "General_Category_Mask" to the property UProperty.GENERAL_CATEGORY_MASK. These names are not in PropertyAliases.txt.- Parameters:
propertyAlias
- the property name to be matched. The name is compared using "loose matching" as described in PropertyAliases.txt.- Returns:
- a UProperty enum.
- Throws:
IllegalArgumentException
- thrown if propertyAlias is not recognized.- See Also:
-
getPropertyValueName
Return the Unicode name for a given property value, as given in the Unicode database file PropertyValueAliases.txt. Most values have more than one name. The nameChoice determines which one is returned. Note: Some of the names in PropertyValueAliases.txt can only be retrieved using UProperty.GENERAL_CATEGORY_MASK, not UProperty.GENERAL_CATEGORY. These include: "C" / "Other", "L" / "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P" / "Punctuation", "S" / "Symbol", and "Z" / "Separator".- Parameters:
property
- UProperty selector constant. UProperty.INT_START <= property < UProperty.INT_LIMIT or UProperty.BINARY_START <= property < UProperty.BINARY_LIMIT or UProperty.MASK_START < = property < UProperty.MASK_LIMIT. If out of range, null is returned.value
- selector for a value for the given property. In general, valid values range from 0 up to some maximum. There are a few exceptions: (1.) UProperty.BLOCK values begin at the non-zero value BASIC_LATIN.getID(). (2.) UProperty.CANONICAL_COMBINING_CLASS values are not contiguous and range from 0..240. (3.) UProperty.GENERAL_CATEGORY_MASK values are mask values produced by left-shifting 1 by UCharacter.getType(). This allows grouped categories such as [:L:] to be represented. Mask values are non-contiguous.nameChoice
- UProperty.NameChoice selector for which name to get. All values have a long name. Most have a short name, but some do not. Unicode allows for additional names; if present these will be returned by UProperty.NameChoice.LONG + i, where i=1, 2,...- Returns:
- a name, or null if Unicode explicitly defines no name ("n/a") for a given property/value/nameChoice. If a given nameChoice throws an exception, then all larger values of nameChoice will throw an exception. If null is returned for a given nameChoice, then other nameChoice values may return non-null results.
- Throws:
IllegalArgumentException
- thrown if property, value, or nameChoice are invalid.- See Also:
-
getPropertyValueEnum
Return the property value integer for a given value name, as specified in the Unicode database file PropertyValueAliases.txt. Short, long, and any other variants are recognized. Note: Some of the names in PropertyValueAliases.txt will only be recognized with UProperty.GENERAL_CATEGORY_MASK, not UProperty.GENERAL_CATEGORY. These include: "C" / "Other", "L" / "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P" / "Punctuation", "S" / "Symbol", and "Z" / "Separator".- Parameters:
property
- UProperty selector constant. UProperty.INT_START <= property < UProperty.INT_LIMIT or UProperty.BINARY_START <= property < UProperty.BINARY_LIMIT or UProperty.MASK_START < = property < UProperty.MASK_LIMIT. Only these properties can be enumerated.valueAlias
- the value name to be matched. The name is compared using "loose matching" as described in PropertyValueAliases.txt.- Returns:
- a value integer. Note: UProperty.GENERAL_CATEGORY values are mask values produced by left-shifting 1 by UCharacter.getType(). This allows grouped categories such as [:L:] to be represented.
- Throws:
IllegalArgumentException
- if property is not a valid UProperty selector or valueAlias is not a value of this property- See Also:
-
getPropertyValueEnumNoThrow
Deprecated.This API is ICU internal only.Same asgetPropertyValueEnum(int, CharSequence)
, except doesn't throw exception. Instead, returns UProperty.UNDEFINED.- Parameters:
property
- Same asgetPropertyValueEnum(int, CharSequence)
valueAlias
- Same asgetPropertyValueEnum(int, CharSequence)
- Returns:
- returns UProperty.UNDEFINED if the value is not valid, otherwise the value.
-
getCodePoint
public static int getCodePoint(int lead, int trail) Returns a code point corresponding to the two surrogate code units.- Parameters:
lead
- the lead unit (In ICU 2.1-69 the type of both parameters waschar
.)trail
- the trail unit- Returns:
- code point if lead and trail form a valid surrogate pair.
- Throws:
IllegalArgumentException
- thrown when the code units do not form a valid surrogate pair- See Also:
-
getCodePoint
public static int getCodePoint(char char16) Returns the code point corresponding to the BMP code point.- Parameters:
char16
- the BMP code point- Returns:
- code point if argument is a valid character.
- Throws:
IllegalArgumentException
- thrown when char16 is not a valid code point
-
toUpperCase
Returns the uppercase version of the argument string. Casing is dependent on the default locale and context-sensitive.- Parameters:
str
- source string to be performed on- Returns:
- uppercase version of the argument string
-
toLowerCase
Returns the lowercase version of the argument string. Casing is dependent on the default locale and context-sensitive- Parameters:
str
- source string to be performed on- Returns:
- lowercase version of the argument string
-
toTitleCase
Returns the titlecase version of the argument string.
Position for titlecasing is determined by the argument break iterator, hence the user can customize his break iterator for a specialized titlecasing. In this case only the forward iteration needs to be implemented. If the break iterator passed in is null, the default Unicode algorithm will be used to determine the titlecase positions.
Only positions returned by the break iterator will be title cased, character in between the positions will all be in lower case.
Casing is dependent on the default locale and context-sensitive
- Parameters:
str
- source string to be performed onbreakiter
- break iterator to determine the positions in which the character should be title cased.- Returns:
- titlecase version of the argument string
-
toUpperCase
Returns the uppercase version of the argument string. Casing is dependent on the argument locale and context-sensitive.- Parameters:
locale
- which string is to be converted instr
- source string to be performed on- Returns:
- uppercase version of the argument string
-
toUpperCase
Returns the uppercase version of the argument string. Casing is dependent on the argument locale and context-sensitive.- Parameters:
locale
- which string is to be converted instr
- source string to be performed on- Returns:
- uppercase version of the argument string
-
toLowerCase
Returns the lowercase version of the argument string. Casing is dependent on the argument locale and context-sensitive- Parameters:
locale
- which string is to be converted instr
- source string to be performed on- Returns:
- lowercase version of the argument string
-
toLowerCase
Returns the lowercase version of the argument string. Casing is dependent on the argument locale and context-sensitive- Parameters:
locale
- which string is to be converted instr
- source string to be performed on- Returns:
- lowercase version of the argument string
-
toTitleCase
Returns the titlecase version of the argument string.
Position for titlecasing is determined by the argument break iterator, hence the user can customize his break iterator for a specialized titlecasing. In this case only the forward iteration needs to be implemented. If the break iterator passed in is null, the default Unicode algorithm will be used to determine the titlecase positions.
Only positions returned by the break iterator will be title cased, character in between the positions will all be in lower case.
Casing is dependent on the argument locale and context-sensitive
- Parameters:
locale
- which string is to be converted instr
- source string to be performed onbreakiter
- break iterator to determine the positions in which the character should be title cased.- Returns:
- titlecase version of the argument string
-
toTitleCase
Returns the titlecase version of the argument string.
Position for titlecasing is determined by the argument break iterator, hence the user can customize his break iterator for a specialized titlecasing. In this case only the forward iteration needs to be implemented. If the break iterator passed in is null, the default Unicode algorithm will be used to determine the titlecase positions.
Only positions returned by the break iterator will be title cased, character in between the positions will all be in lower case.
Casing is dependent on the argument locale and context-sensitive
- Parameters:
locale
- which string is to be converted instr
- source string to be performed ontitleIter
- break iterator to determine the positions in which the character should be title cased.- Returns:
- titlecase version of the argument string
-
toTitleCase
Returns the titlecase version of the argument string.
Position for titlecasing is determined by the argument break iterator, hence the user can customize his break iterator for a specialized titlecasing. In this case only the forward iteration needs to be implemented. If the break iterator passed in is null, the default Unicode algorithm will be used to determine the titlecase positions.
Only positions returned by the break iterator will be title cased, character in between the positions will all be in lower case.
Casing is dependent on the argument locale and context-sensitive
- Parameters:
locale
- which string is to be converted instr
- source string to be performed ontitleIter
- break iterator to determine the positions in which the character should be title cased.options
- bit set to modify the titlecasing operation- Returns:
- titlecase version of the argument string
- See Also:
-
toTitleCase
Returns the titlecase version of the argument string.
Position for titlecasing is determined by the argument break iterator, hence the user can customize his break iterator for a specialized titlecasing. In this case only the forward iteration needs to be implemented. If the break iterator passed in is null, the default Unicode algorithm will be used to determine the titlecase positions.
Only positions returned by the break iterator will be title cased, character in between the positions will all be in lower case.
Casing is dependent on the argument locale and context-sensitive
- Parameters:
locale
- which string is to be converted instr
- source string to be performed ontitleIter
- break iterator to determine the positions in which the character should be title cased.options
- bit set to modify the titlecasing operation- Returns:
- titlecase version of the argument string
- See Also:
-
foldCase
public static int foldCase(int ch, boolean defaultmapping) 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.This function only returns the simple, single-code point case mapping. Full case mappings should be used whenever possible because they produce better results by working on whole strings. They can map to a result string with a different length as appropriate. Full case mappings are applied by the case mapping functions that take String parameters rather than code points (int). See also the User Guide chapter on C/POSIX migration: https://unicode-org.github.io/icu/userguide/icu/posix#case-mappings
- Parameters:
ch
- the character to be converteddefaultmapping
- Indicates whether the default mappings defined in CaseFolding.txt are to be used, otherwise the mappings for dotted I and dotless i marked with 'T' in CaseFolding.txt are included.- Returns:
- the case folding equivalent of the character, if any; otherwise the character itself.
- See Also:
-
foldCase
The given string is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if any character has no case folding equivalent, the character itself is returned. "Full", multiple-code point case folding mappings are returned here. For "simple" single-code point mappings use the API foldCase(int ch, boolean defaultmapping).- Parameters:
str
- the String to be converteddefaultmapping
- Indicates whether the default mappings defined in CaseFolding.txt are to be used, otherwise the mappings for dotted I and dotless i marked with 'T' in CaseFolding.txt are included.- Returns:
- the case folding equivalent of the character, if any; otherwise the character itself.
- See Also:
-
foldCase
public static int foldCase(int ch, int 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.This function only returns the simple, single-code point case mapping. Full case mappings should be used whenever possible because they produce better results by working on whole strings. They can map to a result string with a different length as appropriate. Full case mappings are applied by the case mapping functions that take String parameters rather than code points (int). See also the User Guide chapter on C/POSIX migration: https://unicode-org.github.io/icu/userguide/icu/posix#case-mappings
- Parameters:
ch
- the character to be convertedoptions
- A bit set for special processing. Currently the recognised options are FOLD_CASE_EXCLUDE_SPECIAL_I and FOLD_CASE_DEFAULT- Returns:
- the case folding equivalent of the character, if any; otherwise the character itself.
- See Also:
-
foldCase
The given string is mapped to its case folding equivalent according to UnicodeData.txt and CaseFolding.txt; if any character has no case folding equivalent, the character itself is returned. "Full", multiple-code point case folding mappings are returned here. For "simple" single-code point mappings use the API foldCase(int ch, boolean defaultmapping).- Parameters:
str
- the String to be convertedoptions
- A bit set for special processing. Currently the recognised options are FOLD_CASE_EXCLUDE_SPECIAL_I and FOLD_CASE_DEFAULT- Returns:
- the case folding equivalent of the character, if any; otherwise the character itself.
- See Also:
-
getHanNumericValue
public static int getHanNumericValue(int ch) Returns the numeric value of a Han character.This returns the value of Han 'numeric' code points, including those for zero, ten, hundred, thousand, ten thousand, and hundred million. This includes both the standard and 'checkwriting' characters, the 'big circle' zero character, and the standard zero character.
Note: The Unicode Standard has numeric values for more Han characters recognized by this method (see
getNumericValue(int)
and the UCD file DerivedNumericValues.txt), and aNumberFormat
can be used with a ChineseNumberingSystem
.- Parameters:
ch
- code point to query- Returns:
- value if it is a Han 'numeric character,' otherwise return -1.
-
getTypeIterator
Returns an iterator for character types, iterating over codepoints.
Example of use:
RangeValueIterator iterator = UCharacter.getTypeIterator(); RangeValueIterator.Element element = new RangeValueIterator.Element(); while (iterator.next(element)) { System.out.println("Codepoint \\u" + Integer.toHexString(element.start) + " to codepoint \\u" + Integer.toHexString(element.limit - 1) + " has the character type " + element.value); }
- Returns:
- an iterator
-
getNameIterator
Returns an iterator for character names, iterating over codepoints.
This API only gets the iterator for the modern, most up-to-date Unicode names. For older 1.0 Unicode names use get1_0NameIterator() or for extended names use getExtendedNameIterator().
Example of use:
ValueIterator iterator = UCharacter.getNameIterator(); ValueIterator.Element element = new ValueIterator.Element(); while (iterator.next(element)) { System.out.println("Codepoint \\u" + Integer.toHexString(element.codepoint) + " has the name " + (String)element.value); }
The maximal range which the name iterator iterates is from UCharacter.MIN_VALUE to UCharacter.MAX_VALUE.
- Returns:
- an iterator
-
getName1_0Iterator
Deprecated.ICU 49Returns an empty iterator.Used to return an iterator for the older 1.0 Unicode character names, iterating over codepoints.
- Returns:
- an empty iterator
- See Also:
-
getExtendedNameIterator
Returns an iterator for character names, iterating over codepoints.
This API only gets the iterator for the extended names. For modern, most up-to-date Unicode names use getNameIterator() or for older 1.0 Unicode names use get1_0NameIterator().
Example of use:
ValueIterator iterator = UCharacter.getExtendedNameIterator(); ValueIterator.Element element = new ValueIterator.Element(); while (iterator.next(element)) { System.out.println("Codepoint \\u" + Integer.toHexString(element.codepoint) + " has the name " + (String)element.value); }
The maximal range which the name iterator iterates is from
- Returns:
- an iterator
-
getAge
Returns the "age" of the code point.The "age" is the Unicode version when the code point was first designated (as a non-character or for Private Use) or assigned a character.
This can be useful to avoid emitting code points to receiving processes that do not accept newer characters.
The data is from the UCD file DerivedAge.txt.
- Parameters:
ch
- The code point.- Returns:
- the Unicode version number
-
hasBinaryProperty
public static boolean hasBinaryProperty(int ch, int property) Check a binary Unicode property for a code point.Unicode, especially in version 3.2, defines many more properties than the original set in UnicodeData.txt.
This API is intended to reflect Unicode properties as defined in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR).
For details about the properties see http://www.unicode.org/.
For names of Unicode properties see the UCD file PropertyAliases.txt.
This API does not check the validity of the codepoint.
Important: If ICU is built with UCD files from Unicode versions below 3.2, then properties marked with "new" are not or not fully available.
- Parameters:
ch
- code point to test.property
- selector constant from com.ibm.icu.lang.UProperty, identifies which binary property to check.- Returns:
- true or false according to the binary Unicode property value for ch. Also false if property is out of bounds or if the Unicode version does not have data for the property at all, or not for this code point.
- See Also:
-
hasBinaryProperty
Returns true if the property is true for the string. Same ashasBinaryProperty(int, int)
if the string contains exactly one code point.Most properties apply only to single code points. UTS #51 Unicode Emoji defines several properties of strings.
- Parameters:
s
- String to test.property
- UProperty selector constant, identifies which binary property to check. Must be BINARY_START<=which<BINARY_LIMIT.- Returns:
- true or false according to the binary Unicode property value for the string.
Also false if
property
is out of bounds or if the Unicode version does not have data for the property at all. - See Also:
-
isUAlphabetic
public static boolean isUAlphabetic(int ch) Check if a code point has the Alphabetic Unicode property.
Same as UCharacter.hasBinaryProperty(ch, UProperty.ALPHABETIC).
Different from UCharacter.isLetter(ch)!
- Parameters:
ch
- codepoint to be tested
-
isULowercase
public static boolean isULowercase(int ch) Check if a code point has the Lowercase Unicode property.
Same as UCharacter.hasBinaryProperty(ch, UProperty.LOWERCASE).
This is different from UCharacter.isLowerCase(ch)!
- Parameters:
ch
- codepoint to be tested
-
isUUppercase
public static boolean isUUppercase(int ch) Check if a code point has the Uppercase Unicode property.
Same as UCharacter.hasBinaryProperty(ch, UProperty.UPPERCASE).
This is different from UCharacter.isUpperCase(ch)!
- Parameters:
ch
- codepoint to be tested
-
isUWhiteSpace
public static boolean isUWhiteSpace(int ch) Check if a code point has the White_Space Unicode property.
Same as UCharacter.hasBinaryProperty(ch, UProperty.WHITE_SPACE).
This is different from both UCharacter.isSpace(ch) and UCharacter.isWhitespace(ch)!
- Parameters:
ch
- codepoint to be tested
-
getIntPropertyValue
public static int getIntPropertyValue(int ch, int type) Returns the property value for a Unicode property type of a code point. Also returns binary and mask property values.Unicode, especially in version 3.2, defines many more properties than the original set in UnicodeData.txt.
The properties APIs are intended to reflect Unicode properties as defined in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). For details about the properties see http://www.unicode.org/.
For names of Unicode properties see the UCD file PropertyAliases.txt.
Sample usage: int ea = UCharacter.getIntPropertyValue(c, UProperty.EAST_ASIAN_WIDTH); int ideo = UCharacter.getIntPropertyValue(c, UProperty.IDEOGRAPHIC); boolean b = (ideo == 1) ? true : false;
- Parameters:
ch
- code point to test.type
- UProperty selector constant, identifies which binary property to check. Must be UProperty.BINARY_START <= type < UProperty.BINARY_LIMIT or UProperty.INT_START <= type < UProperty.INT_LIMIT or UProperty.MASK_START <= type < UProperty.MASK_LIMIT.- Returns:
- numeric value that is directly the property value or,
for enumerated properties, corresponds to the numeric value of
the enumerated constant of the respective property value type
(
UCharacterEnums.ECharacterCategory
,UCharacterEnums.ECharacterDirection
,UCharacter.DecompositionType
, etc.). Returns 0 or 1 (for false / true) for binary Unicode properties. Returns a bit-mask for mask properties. Returns 0 if 'type' is out of bounds or if the Unicode version does not have data for the property at all, or not for this code point. - See Also:
-
getStringPropertyValue
@Deprecated public static String getStringPropertyValue(int propertyEnum, int codepoint, int nameChoice) Deprecated.This API is ICU internal only.Returns a string version of the property value.- Parameters:
propertyEnum
- The property enum value.codepoint
- The codepoint value.nameChoice
- The choice of the name.- Returns:
- value as string
-
getIntPropertyMinValue
public static int getIntPropertyMinValue(int type) Returns the minimum value for an integer/binary Unicode property type. Can be used together with UCharacter.getIntPropertyMaxValue(int) to allocate arrays of com.ibm.icu.text.UnicodeSet or similar.- Parameters:
type
- UProperty selector constant, identifies which binary property to check. Must be UProperty.BINARY_START <= type < UProperty.BINARY_LIMIT or UProperty.INT_START <= type < UProperty.INT_LIMIT.- Returns:
- Minimum value returned by UCharacter.getIntPropertyValue(int) for a Unicode property. 0 if the property selector 'type' is out of range.
- See Also:
-
getIntPropertyMaxValue
public static int getIntPropertyMaxValue(int type) Returns the maximum value for an integer/binary Unicode property. Can be used together with UCharacter.getIntPropertyMinValue(int) to allocate arrays of com.ibm.icu.text.UnicodeSet or similar. Examples for min/max values (for Unicode 3.2):- UProperty.BIDI_CLASS: 0/18 (UCharacterDirection.LEFT_TO_RIGHT/UCharacterDirection.BOUNDARY_NEUTRAL)
- UProperty.SCRIPT: 0/45 (UScript.COMMON/UScript.TAGBANWA)
- UProperty.IDEOGRAPHIC: 0/1 (false/true)
- Parameters:
type
- UProperty selector constant, identifies which binary property to check. Must be UProperty.BINARY_START <= type < UProperty.BINARY_LIMIT or UProperty.INT_START <= type < UProperty.INT_LIMIT.- Returns:
- Maximum value returned by u_getIntPropertyValue for a Unicode property. <= 0 if the property selector 'type' is out of range.
- See Also:
-
forDigit
public static char forDigit(int digit, int radix) Provide the java.lang.Character forDigit API, for convenience. -
isValidCodePoint
public static final boolean isValidCodePoint(int cp) Equivalent toCharacter.isValidCodePoint(int)
.- Parameters:
cp
- the code point to check- Returns:
- true if cp is a valid code point
-
isSupplementaryCodePoint
public static final boolean isSupplementaryCodePoint(int cp) - Parameters:
cp
- the code point to check- Returns:
- true if cp is a supplementary code point
-
isHighSurrogate
public static boolean isHighSurrogate(int codePoint) Same asCharacter.isHighSurrogate(char)
, except that the ICU version acceptsint
for code points.- Parameters:
codePoint
- the code point to check (In ICU 3.0-69 the type of this parameter waschar
.)- Returns:
- true if codePoint is a high (lead) surrogate
-
isLowSurrogate
public static boolean isLowSurrogate(int codePoint) Same asCharacter.isLowSurrogate(char)
, except that the ICU version acceptsint
for code points.- Parameters:
codePoint
- the code point to check (In ICU 3.0-69 the type of this parameter waschar
.)- Returns:
- true if codePoint is a low (trail) surrogate
-
isSurrogatePair
public static final boolean isSurrogatePair(int high, int low) Same asCharacter.isSurrogatePair(char, char)
, except that the ICU version acceptsint
for code points.- Parameters:
high
- the high (lead) unit (In ICU 3.0-69 the type of both parameters waschar
.)low
- the low (trail) unit- Returns:
- true if high, low form a surrogate pair
-
charCount
public static int charCount(int cp) Same asCharacter.charCount(int)
. Returns the number of chars needed to represent the code point (1 or 2). This does not check the code point for validity.- Parameters:
cp
- the code point to check- Returns:
- the number of chars needed to represent the code point
-
toCodePoint
public static final int toCodePoint(int high, int low) Same asCharacter.toCodePoint(char, char)
, except that the ICU version acceptsint
for code points. Returns the code point represented by the two surrogate code units. This does not check the surrogate pair for validity.- Parameters:
high
- the high (lead) surrogate (In ICU 3.0-69 the type of both parameters waschar
.)low
- the low (trail) surrogate- Returns:
- the code point formed by the surrogate pair
- See Also:
-
codePointAt
Same asCharacter.codePointAt(CharSequence, int)
. Returns the code point at index. This examines only the characters at index and index+1.- Parameters:
seq
- the characters to checkindex
- the index of the first or only char forming the code point- Returns:
- the code point at the index
-
codePointAt
public static final int codePointAt(char[] text, int index) Same asCharacter.codePointAt(char[], int)
. Returns the code point at index. This examines only the characters at index and index+1.- Parameters:
text
- the characters to checkindex
- the index of the first or only char forming the code point- Returns:
- the code point at the index
-
codePointAt
public static final int codePointAt(char[] text, int index, int limit) Same asCharacter.codePointAt(char[], int, int)
. Returns the code point at index. This examines only the characters at index and index+1.- Parameters:
text
- the characters to checkindex
- the index of the first or only char forming the code pointlimit
- the limit of the valid text- Returns:
- the code point at the index
-
codePointBefore
Same asCharacter.codePointBefore(CharSequence, int)
. Return the code point before index. This examines only the characters at index-1 and index-2.- Parameters:
seq
- the characters to checkindex
- the index after the last or only char forming the code point- Returns:
- the code point before the index
-
codePointBefore
public static final int codePointBefore(char[] text, int index) Same asCharacter.codePointBefore(char[], int)
. Returns the code point before index. This examines only the characters at index-1 and index-2.- Parameters:
text
- the characters to checkindex
- the index after the last or only char forming the code point- Returns:
- the code point before the index
-
codePointBefore
public static final int codePointBefore(char[] text, int index, int limit) Same asCharacter.codePointBefore(char[], int, int)
. Return the code point before index. This examines only the characters at index-1 and index-2.- Parameters:
text
- the characters to checkindex
- the index after the last or only char forming the code pointlimit
- the start of the valid text- Returns:
- the code point before the index
-
toChars
public static final int toChars(int cp, char[] dst, int dstIndex) Same asCharacter.toChars(int, char[], int)
. Writes the chars representing the code point into the destination at the given index.- Parameters:
cp
- the code point to convertdst
- the destination array into which to put the char(s) representing the code pointdstIndex
- the index at which to put the first (or only) char- Returns:
- the count of the number of chars written (1 or 2)
- Throws:
IllegalArgumentException
- if cp is not a valid code point
-
toChars
public static final char[] toChars(int cp) Same asCharacter.toChars(int)
. Returns a char array representing the code point.- Parameters:
cp
- the code point to convert- Returns:
- an array containing the char(s) representing the code point
- Throws:
IllegalArgumentException
- if cp is not a valid code point
-
getDirectionality
public static byte getDirectionality(int cp) Equivalent to theCharacter.getDirectionality(char)
method, for convenience. Returns a byte representing the directionality of the character. UnlikeCharacter.getDirectionality(char)
, this returns DIRECTIONALITY_LEFT_TO_RIGHT for undefined or out-of-bounds characters. The return value must be tested using the constants defined inUCharacterDirection
and its interfaceUCharacterEnums.ECharacterDirection
since the values are different from the ones defined byjava.lang.Character
.- Parameters:
cp
- the code point to check- Returns:
- the directionality of the code point
- See Also:
-
codePointCount
Equivalent to theCharacter.codePointCount(CharSequence, int, int)
method, for convenience. Counts the number of code points in the range of text.- Parameters:
text
- the characters to checkstart
- the start of the rangelimit
- the limit of the range- Returns:
- the number of code points in the range
-
codePointCount
public static int codePointCount(char[] text, int start, int limit) Equivalent to theCharacter.codePointCount(char[], int, int)
method, for convenience. Counts the number of code points in the range of text.- Parameters:
text
- the characters to checkstart
- the start of the rangelimit
- the limit of the range- Returns:
- the number of code points in the range
-
offsetByCodePoints
Equivalent to theCharacter.offsetByCodePoints(CharSequence, int, int)
method, for convenience. Adjusts the char index by a code point offset.- Parameters:
text
- the characters to checkindex
- the index to adjustcodePointOffset
- the number of code points by which to offset the index- Returns:
- the adjusted index
-
offsetByCodePoints
public static int offsetByCodePoints(char[] text, int start, int count, int index, int codePointOffset) Equivalent to theCharacter.offsetByCodePoints(char[], int, int, int, int)
method, for convenience. Adjusts the char index by a code point offset.- Parameters:
text
- the characters to checkstart
- the start of the range to checkcount
- the length of the range to checkindex
- the index to adjustcodePointOffset
- the number of code points by which to offset the index- Returns:
- the adjusted index
-