📄 character.java
字号:
* The following are examples of uppercase characters: * <p><blockquote><pre> * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7' * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF' * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8' * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE' * </pre></blockquote> * <p> Many other Unicode characters are uppercase too.<p> * * @param ch the character to be tested. * @return <code>true</code> if the character is uppercase; * <code>false</code> otherwise. * @see java.lang.Character#isLowerCase(char) * @see java.lang.Character#isTitleCase(char) * @see java.lang.Character#toUpperCase(char) * @see java.lang.Character#getType(char) * @since 1.0 */ public static boolean isUpperCase(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isUpperCase(ch); } else { return CharacterData.isUpperCase(ch); } } /** * Determines if the specified character is a titlecase character. * <p> * A character is a titlecase character if its general * category type, provided by <code>Character.getType(ch)</code>, * is <code>TITLECASE_LETTER</code>. * <p> * Some characters look like pairs of Latin letters. For example, there * is an uppercase letter that looks like "LJ" and has a corresponding * lowercase letter that looks like "lj". A third form, which looks like "Lj", * is the appropriate form to use when rendering a word in lowercase * with initial capitals, as for a book title. * <p> * These are some of the Unicode characters for which this method returns * <code>true</code>: * <ul> * <li><code>LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON</code> * <li><code>LATIN CAPITAL LETTER L WITH SMALL LETTER J</code> * <li><code>LATIN CAPITAL LETTER N WITH SMALL LETTER J</code> * <li><code>LATIN CAPITAL LETTER D WITH SMALL LETTER Z</code> * </ul> * <p> Many other Unicode characters are titlecase too.<p> * * @param ch the character to be tested. * @return <code>true</code> if the character is titlecase; * <code>false</code> otherwise. * @see java.lang.Character#isLowerCase(char) * @see java.lang.Character#isUpperCase(char) * @see java.lang.Character#toTitleCase(char) * @see java.lang.Character#getType(char) * @since 1.0.2 */ public static boolean isTitleCase(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isTitleCase(ch); } else { return CharacterData.isTitleCase(ch); } } /** * Determines if the specified character is a digit. * <p> * A character is a digit if its general category type, provided * by <code>Character.getType(ch)</code>, is * <code>DECIMAL_DIGIT_NUMBER</code>. * <p> * Some Unicode character ranges that contain digits: * <ul> * <li><code>'\u0030'</code> through <code>'\u0039'</code>, * ISO-LATIN-1 digits (<code>'0'</code> through <code>'9'</code>) * <li><code>'\u0660'</code> through <code>'\u0669'</code>, * Arabic-Indic digits * <li><code>'\u06F0'</code> through <code>'\u06F9'</code>, * Extended Arabic-Indic digits * <li><code>'\u0966'</code> through <code>'\u096F'</code>, * Devanagari digits * <li><code>'\uFF10'</code> through <code>'\uFF19'</code>, * Fullwidth digits * </ul> * * Many other character ranges contain digits as well. * * @param ch the character to be tested. * @return <code>true</code> if the character is a digit; * <code>false</code> otherwise. * @see java.lang.Character#digit(char, int) * @see java.lang.Character#forDigit(int, int) * @see java.lang.Character#getType(char) */ public static boolean isDigit(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isDigit(ch); } else { return CharacterData.isDigit(ch); } } /** * Determines if a character is defined in Unicode. * <p> * A character is defined if at least one of the following is true: * <ul> * <li>It has an entry in the UnicodeData file. * <li>It has a value in a range defined by the UnicodeData file. * </ul> * * @param ch the character to be tested * @return <code>true</code> if the character has a defined meaning * in Unicode; <code>false</code> otherwise. * @see java.lang.Character#isDigit(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isLetterOrDigit(char) * @see java.lang.Character#isLowerCase(char) * @see java.lang.Character#isTitleCase(char) * @see java.lang.Character#isUpperCase(char) * @since 1.0.2 */ public static boolean isDefined(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isDefined(ch); } else { return CharacterData.isDefined(ch); } } /** * Determines if the specified character is a letter. * <p> * A character is considered to be a letter if its general * category type, provided by <code>Character.getType(ch)</code>, * is any of the following: * <ul> * <li> <code>UPPERCASE_LETTER</code> * <li> <code>LOWERCASE_LETTER</code> * <li> <code>TITLECASE_LETTER</code> * <li> <code>MODIFIER_LETTER</code> * <li> <code>OTHER_LETTER</code> * </ul> * * Not all letters have case. Many characters are * letters but are neither uppercase nor lowercase nor titlecase. * * @param ch the character to be tested. * @return <code>true</code> if the character is a letter; * <code>false</code> otherwise. * @see java.lang.Character#isDigit(char) * @see java.lang.Character#isJavaIdentifierStart(char) * @see java.lang.Character#isJavaLetter(char) * @see java.lang.Character#isJavaLetterOrDigit(char) * @see java.lang.Character#isLetterOrDigit(char) * @see java.lang.Character#isLowerCase(char) * @see java.lang.Character#isTitleCase(char) * @see java.lang.Character#isUnicodeIdentifierStart(char) * @see java.lang.Character#isUpperCase(char) */ public static boolean isLetter(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isLetter(ch); } else { return CharacterData.isLetter(ch); } } /** * Determines if the specified character is a letter or digit. * <p> * A character is considered to be a letter or digit if either * <code>Character.isLetter(char ch)</code> or * <code>Character.isDigit(char ch)</code> returns * <code>true</code> for the character. * * @param ch the character to be tested. * @return <code>true</code> if the character is a letter or digit; * <code>false</code> otherwise. * @see java.lang.Character#isDigit(char) * @see java.lang.Character#isJavaIdentifierPart(char) * @see java.lang.Character#isJavaLetter(char) * @see java.lang.Character#isJavaLetterOrDigit(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isUnicodeIdentifierPart(char) * @since 1.0.2 */ public static boolean isLetterOrDigit(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isLetterOrDigit(ch); } else { return CharacterData.isLetterOrDigit(ch); } } /** * Determines if the specified character is permissible as the first * character in a Java identifier. * <p> * A character may start a Java identifier if and only if * one of the following is true: * <ul> * <li> {@link #isLetter(char) isLetter(ch)} returns <code>true</code> * <li> {@link #getType(char) getType(ch)} returns <code>LETTER_NUMBER</code> * <li> ch is a currency symbol (such as "$") * <li> ch is a connecting punctuation character (such as "_"). * </ul> * * @param ch the character to be tested. * @return <code>true</code> if the character may start a Java * identifier; <code>false</code> otherwise. * @see java.lang.Character#isJavaLetterOrDigit(char) * @see java.lang.Character#isJavaIdentifierStart(char) * @see java.lang.Character#isJavaIdentifierPart(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isLetterOrDigit(char) * @see java.lang.Character#isUnicodeIdentifierStart(char) * @since 1.02 * deprecated Replaced by isJavaIdentifierStart(char). *//** public static boolean isJavaLetter(char ch) {* return isJavaIdentifierStart(ch);* }*/ /** * Determines if the specified character may be part of a Java * identifier as other than the first character. * <p> * A character may be part of a Java identifier if and only if any * of the following are true: * <ul> * <li> it is a letter * <li> it is a currency symbol (such as <code>'$'</code>) * <li> it is a connecting punctuation character (such as <code>'_'</code>) * <li> it is a digit * <li> it is a numeric letter (such as a Roman numeral character) * <li> it is a combining mark * <li> it is a non-spacing mark * <li> <code>isIdentifierIgnorable</code> returns * <code>true</code> for the character. * </ul> * * @param ch the character to be tested. * @return <code>true</code> if the character may be part of a * Java identifier; <code>false</code> otherwise. * @see java.lang.Character#isJavaLetter(char) * @see java.lang.Character#isJavaIdentifierStart(char) * @see java.lang.Character#isJavaIdentifierPart(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isLetterOrDigit(char) * @see java.lang.Character#isUnicodeIdentifierPart(char) * @see java.lang.Character#isIdentifierIgnorable(char) * @since 1.02 * deprecated Replaced by isJavaIdentifierPart(char). *//** public static boolean isJavaLetterOrDigit(char ch) {** return isJavaIdentifierPart(ch);* }*/ /** * Determines if the specified character is * permissible as the first character in a Java identifier. * <p> * A character may start a Java identifier if and only if * one of the following conditions is true: * <ul> * <li> {@link #isLetter(char) isLetter(ch)} returns <code>true</code> * <li> {@link #getType(char) getType(ch)} returns <code>LETTER_NUMBER</code> * <li> ch is a currency symbol (such as "$") * <li> ch is a connecting punctuation character (such as "_"). * </ul> * * @param ch the character to be tested. * @return <code>true</code> if the character may start a Java identifier; * <code>false</code> otherwise. * @see java.lang.Character#isJavaIdentifierPart(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isUnicodeIdentifierStart(char) * @since 1.1 */ public static boolean isJavaIdentifierStart(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isJavaIdentifierStart(ch); } else { return CharacterData.isJavaIdentifierStart(ch); } } /** * Determines if the specified character may be part of a Java * identifier as other than the first character. * <p> * A character may be part of a Java identifier if any of the following * are true: * <ul> * <li> it is a letter * <li> it is a currency symbol (such as <code>'$'</code>) * <li> it is a connecting punctuation character (such as <code>'_'</code>) * <li> it is a digit * <li> it is a numeric letter (such as a Roman numeral character) * <li> it is a combining mark * <li> it is a non-spacing mark * <li> <code>isIdentifierIgnorable</code> returns * <code>true</code> for the character * </ul> * * @param ch the character to be tested. * @return <code>true</code> if the character may be part of a * Java identifier; <code>false</code> otherwise. * @see java.lang.Character#isIdentifierIgnorable(char) * @see java.lang.Character#isJavaIdentifierStart(char) * @see java.lang.Character#isLetterOrDigit(char) * @see java.lang.Character#isUnicodeIdentifierPart(char) * @since 1.1 */ public static boolean isJavaIdentifierPart(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isJavaIdentifierPart(ch); } else { return CharacterData.isJavaIdentifierPart(ch); } } /** * Determines if the specified character is permissible as the * first character in a Unicode identifier. * <p> * A character may start a Unicode identifier if and only if * one of the following conditions is true: * <ul> * <li> {@link #isLetter(char) isLetter(ch)} returns <code>true</code> * <li> {@link #getType(char) getType(ch)} returns * <code>LETTER_NUMBER</code>. * </ul> * @param ch the character to be tested. * @return <code>true</code> if the character may start a Unicode * identifier; <code>false</code> otherwise. * @see java.lang.Character#isJavaIdentifierStart(char) * @see java.lang.Character#isLetter(char) * @see java.lang.Character#isUnicodeIdentifierPart(char) * @since 1.1 */ public static boolean isUnicodeIdentifierStart(char ch) { if (ch <= FAST_PATH_MAX) { return CharacterDataLatin1.isUnicodeIdentifierStart(ch); } else { return CharacterData.isUnicodeIdentifierStart(ch); } } /** * Determines if the specified character may be part of a Unicode * identifier as other than the first character. * <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -