src/java.base/share/classes/java/lang/Character.java

Print this page




8830      * The following are examples of lowercase characters:
8831      * <blockquote><pre>
8832      * 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
8833      * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
8834      * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
8835      * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
8836      * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
8837      * </pre></blockquote>
8838      * <p> Many other Unicode characters are lowercase too.
8839      *
8840      * @param   codePoint the character (Unicode code point) to be tested.
8841      * @return  {@code true} if the character is lowercase;
8842      *          {@code false} otherwise.
8843      * @see     Character#isLowerCase(int)
8844      * @see     Character#isTitleCase(int)
8845      * @see     Character#toLowerCase(int)
8846      * @see     Character#getType(int)
8847      * @since   1.5
8848      */
8849     public static boolean isLowerCase(int codePoint) {
8850         return getType(codePoint) == Character.LOWERCASE_LETTER ||
8851                CharacterData.of(codePoint).isOtherLowercase(codePoint);
8852     }
8853 
8854     /**
8855      * Determines if the specified character is an uppercase character.
8856      * <p>
8857      * A character is uppercase if its general category type, provided by
8858      * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
8859      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
8860      * <p>
8861      * The following are examples of uppercase characters:
8862      * <blockquote><pre>
8863      * 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
8864      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
8865      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
8866      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
8867      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
8868      * </pre></blockquote>
8869      * <p> Many other Unicode characters are uppercase too.
8870      *


8896      * The following are examples of uppercase characters:
8897      * <blockquote><pre>
8898      * 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
8899      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
8900      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
8901      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
8902      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
8903      * </pre></blockquote>
8904      * <p> Many other Unicode characters are uppercase too.
8905      *
8906      * @param   codePoint the character (Unicode code point) to be tested.
8907      * @return  {@code true} if the character is uppercase;
8908      *          {@code false} otherwise.
8909      * @see     Character#isLowerCase(int)
8910      * @see     Character#isTitleCase(int)
8911      * @see     Character#toUpperCase(int)
8912      * @see     Character#getType(int)
8913      * @since   1.5
8914      */
8915     public static boolean isUpperCase(int codePoint) {
8916         return getType(codePoint) == Character.UPPERCASE_LETTER ||
8917                CharacterData.of(codePoint).isOtherUppercase(codePoint);
8918     }
8919 
8920     /**
8921      * Determines if the specified character is a titlecase character.
8922      * <p>
8923      * A character is a titlecase character if its general
8924      * category type, provided by {@code Character.getType(ch)},
8925      * is {@code TITLECASE_LETTER}.
8926      * <p>
8927      * Some characters look like pairs of Latin letters. For example, there
8928      * is an uppercase letter that looks like "LJ" and has a corresponding
8929      * lowercase letter that looks like "lj". A third form, which looks like "Lj",
8930      * is the appropriate form to use when rendering a word in lowercase
8931      * with initial capitals, as for a book title.
8932      * <p>
8933      * These are some of the Unicode characters for which this method returns
8934      * {@code true}:
8935      * <ul>
8936      * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}


9047      * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
9048      *     Arabic-Indic digits
9049      * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
9050      *     Extended Arabic-Indic digits
9051      * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
9052      *     Devanagari digits
9053      * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
9054      *     Fullwidth digits
9055      * </ul>
9056      *
9057      * Many other character ranges contain digits as well.
9058      *
9059      * @param   codePoint the character (Unicode code point) to be tested.
9060      * @return  {@code true} if the character is a digit;
9061      *          {@code false} otherwise.
9062      * @see     Character#forDigit(int, int)
9063      * @see     Character#getType(int)
9064      * @since   1.5
9065      */
9066     public static boolean isDigit(int codePoint) {
9067         return getType(codePoint) == Character.DECIMAL_DIGIT_NUMBER;
9068     }
9069 
9070     /**
9071      * Determines if a character is defined in Unicode.
9072      * <p>
9073      * A character is defined if at least one of the following is true:
9074      * <ul>
9075      * <li>It has an entry in the UnicodeData file.
9076      * <li>It has a value in a range defined by the UnicodeData file.
9077      * </ul>
9078      *
9079      * <p><b>Note:</b> This method cannot handle <a
9080      * href="#supplementary"> supplementary characters</a>. To support
9081      * all Unicode characters, including supplementary characters, use
9082      * the {@link #isDefined(int)} method.
9083      *
9084      * @param   ch   the character to be tested
9085      * @return  {@code true} if the character has a defined meaning
9086      *          in Unicode; {@code false} otherwise.
9087      * @see     Character#isDigit(char)




8830      * The following are examples of lowercase characters:
8831      * <blockquote><pre>
8832      * 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
8833      * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
8834      * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
8835      * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
8836      * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
8837      * </pre></blockquote>
8838      * <p> Many other Unicode characters are lowercase too.
8839      *
8840      * @param   codePoint the character (Unicode code point) to be tested.
8841      * @return  {@code true} if the character is lowercase;
8842      *          {@code false} otherwise.
8843      * @see     Character#isLowerCase(int)
8844      * @see     Character#isTitleCase(int)
8845      * @see     Character#toLowerCase(int)
8846      * @see     Character#getType(int)
8847      * @since   1.5
8848      */
8849     public static boolean isLowerCase(int codePoint) {
8850         return CharacterData.of(codePoint).isLowerCase(codePoint) ||
8851                CharacterData.of(codePoint).isOtherLowercase(codePoint);
8852     }
8853 
8854     /**
8855      * Determines if the specified character is an uppercase character.
8856      * <p>
8857      * A character is uppercase if its general category type, provided by
8858      * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
8859      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
8860      * <p>
8861      * The following are examples of uppercase characters:
8862      * <blockquote><pre>
8863      * 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
8864      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
8865      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
8866      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
8867      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
8868      * </pre></blockquote>
8869      * <p> Many other Unicode characters are uppercase too.
8870      *


8896      * The following are examples of uppercase characters:
8897      * <blockquote><pre>
8898      * 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
8899      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
8900      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
8901      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
8902      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
8903      * </pre></blockquote>
8904      * <p> Many other Unicode characters are uppercase too.
8905      *
8906      * @param   codePoint the character (Unicode code point) to be tested.
8907      * @return  {@code true} if the character is uppercase;
8908      *          {@code false} otherwise.
8909      * @see     Character#isLowerCase(int)
8910      * @see     Character#isTitleCase(int)
8911      * @see     Character#toUpperCase(int)
8912      * @see     Character#getType(int)
8913      * @since   1.5
8914      */
8915     public static boolean isUpperCase(int codePoint) {
8916         return CharacterData.of(codePoint).isUpperCase(codePoint) ||
8917                CharacterData.of(codePoint).isOtherUppercase(codePoint);
8918     }
8919 
8920     /**
8921      * Determines if the specified character is a titlecase character.
8922      * <p>
8923      * A character is a titlecase character if its general
8924      * category type, provided by {@code Character.getType(ch)},
8925      * is {@code TITLECASE_LETTER}.
8926      * <p>
8927      * Some characters look like pairs of Latin letters. For example, there
8928      * is an uppercase letter that looks like "LJ" and has a corresponding
8929      * lowercase letter that looks like "lj". A third form, which looks like "Lj",
8930      * is the appropriate form to use when rendering a word in lowercase
8931      * with initial capitals, as for a book title.
8932      * <p>
8933      * These are some of the Unicode characters for which this method returns
8934      * {@code true}:
8935      * <ul>
8936      * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}


9047      * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
9048      *     Arabic-Indic digits
9049      * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
9050      *     Extended Arabic-Indic digits
9051      * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
9052      *     Devanagari digits
9053      * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
9054      *     Fullwidth digits
9055      * </ul>
9056      *
9057      * Many other character ranges contain digits as well.
9058      *
9059      * @param   codePoint the character (Unicode code point) to be tested.
9060      * @return  {@code true} if the character is a digit;
9061      *          {@code false} otherwise.
9062      * @see     Character#forDigit(int, int)
9063      * @see     Character#getType(int)
9064      * @since   1.5
9065      */
9066     public static boolean isDigit(int codePoint) {
9067         return CharacterData.of(codePoint).isDigit(codePoint);
9068     }
9069 
9070     /**
9071      * Determines if a character is defined in Unicode.
9072      * <p>
9073      * A character is defined if at least one of the following is true:
9074      * <ul>
9075      * <li>It has an entry in the UnicodeData file.
9076      * <li>It has a value in a range defined by the UnicodeData file.
9077      * </ul>
9078      *
9079      * <p><b>Note:</b> This method cannot handle <a
9080      * href="#supplementary"> supplementary characters</a>. To support
9081      * all Unicode characters, including supplementary characters, use
9082      * the {@link #isDefined(int)} method.
9083      *
9084      * @param   ch   the character to be tested
9085      * @return  {@code true} if the character has a defined meaning
9086      *          in Unicode; {@code false} otherwise.
9087      * @see     Character#isDigit(char)