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

Print this page




9067      * The following are examples of lowercase characters:
9068      * <blockquote><pre>
9069      * 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
9070      * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
9071      * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
9072      * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
9073      * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
9074      * </pre></blockquote>
9075      * <p> Many other Unicode characters are lowercase too.
9076      *
9077      * @param   codePoint the character (Unicode code point) to be tested.
9078      * @return  {@code true} if the character is lowercase;
9079      *          {@code false} otherwise.
9080      * @see     Character#isLowerCase(int)
9081      * @see     Character#isTitleCase(int)
9082      * @see     Character#toLowerCase(int)
9083      * @see     Character#getType(int)
9084      * @since   1.5
9085      */
9086     public static boolean isLowerCase(int codePoint) {
9087         return getType(codePoint) == Character.LOWERCASE_LETTER ||
9088                CharacterData.of(codePoint).isOtherLowercase(codePoint);
9089     }
9090 
9091     /**
9092      * Determines if the specified character is an uppercase character.
9093      * <p>
9094      * A character is uppercase if its general category type, provided by
9095      * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
9096      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
9097      * <p>
9098      * The following are examples of uppercase characters:
9099      * <blockquote><pre>
9100      * 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
9101      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
9102      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
9103      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
9104      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
9105      * </pre></blockquote>
9106      * <p> Many other Unicode characters are uppercase too.
9107      *


9133      * The following are examples of uppercase characters:
9134      * <blockquote><pre>
9135      * 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
9136      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
9137      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
9138      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
9139      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
9140      * </pre></blockquote>
9141      * <p> Many other Unicode characters are uppercase too.
9142      *
9143      * @param   codePoint the character (Unicode code point) to be tested.
9144      * @return  {@code true} if the character is uppercase;
9145      *          {@code false} otherwise.
9146      * @see     Character#isLowerCase(int)
9147      * @see     Character#isTitleCase(int)
9148      * @see     Character#toUpperCase(int)
9149      * @see     Character#getType(int)
9150      * @since   1.5
9151      */
9152     public static boolean isUpperCase(int codePoint) {
9153         return getType(codePoint) == Character.UPPERCASE_LETTER ||
9154                CharacterData.of(codePoint).isOtherUppercase(codePoint);
9155     }
9156 
9157     /**
9158      * Determines if the specified character is a titlecase character.
9159      * <p>
9160      * A character is a titlecase character if its general
9161      * category type, provided by {@code Character.getType(ch)},
9162      * is {@code TITLECASE_LETTER}.
9163      * <p>
9164      * Some characters look like pairs of Latin letters. For example, there
9165      * is an uppercase letter that looks like "LJ" and has a corresponding
9166      * lowercase letter that looks like "lj". A third form, which looks like "Lj",
9167      * is the appropriate form to use when rendering a word in lowercase
9168      * with initial capitals, as for a book title.
9169      * <p>
9170      * These are some of the Unicode characters for which this method returns
9171      * {@code true}:
9172      * <ul>
9173      * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}


9284      * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
9285      *     Arabic-Indic digits
9286      * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
9287      *     Extended Arabic-Indic digits
9288      * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
9289      *     Devanagari digits
9290      * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
9291      *     Fullwidth digits
9292      * </ul>
9293      *
9294      * Many other character ranges contain digits as well.
9295      *
9296      * @param   codePoint the character (Unicode code point) to be tested.
9297      * @return  {@code true} if the character is a digit;
9298      *          {@code false} otherwise.
9299      * @see     Character#forDigit(int, int)
9300      * @see     Character#getType(int)
9301      * @since   1.5
9302      */
9303     public static boolean isDigit(int codePoint) {
9304         return getType(codePoint) == Character.DECIMAL_DIGIT_NUMBER;
9305     }
9306 
9307     /**
9308      * Determines if a character is defined in Unicode.
9309      * <p>
9310      * A character is defined if at least one of the following is true:
9311      * <ul>
9312      * <li>It has an entry in the UnicodeData file.
9313      * <li>It has a value in a range defined by the UnicodeData file.
9314      * </ul>
9315      *
9316      * <p><b>Note:</b> This method cannot handle <a
9317      * href="#supplementary"> supplementary characters</a>. To support
9318      * all Unicode characters, including supplementary characters, use
9319      * the {@link #isDefined(int)} method.
9320      *
9321      * @param   ch   the character to be tested
9322      * @return  {@code true} if the character has a defined meaning
9323      *          in Unicode; {@code false} otherwise.
9324      * @see     Character#isDigit(char)




9067      * The following are examples of lowercase characters:
9068      * <blockquote><pre>
9069      * 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
9070      * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
9071      * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
9072      * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
9073      * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
9074      * </pre></blockquote>
9075      * <p> Many other Unicode characters are lowercase too.
9076      *
9077      * @param   codePoint the character (Unicode code point) to be tested.
9078      * @return  {@code true} if the character is lowercase;
9079      *          {@code false} otherwise.
9080      * @see     Character#isLowerCase(int)
9081      * @see     Character#isTitleCase(int)
9082      * @see     Character#toLowerCase(int)
9083      * @see     Character#getType(int)
9084      * @since   1.5
9085      */
9086     public static boolean isLowerCase(int codePoint) {
9087         return CharacterData.of(codePoint).isLowerCase(codePoint) ||
9088                CharacterData.of(codePoint).isOtherLowercase(codePoint);
9089     }
9090 
9091     /**
9092      * Determines if the specified character is an uppercase character.
9093      * <p>
9094      * A character is uppercase if its general category type, provided by
9095      * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
9096      * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
9097      * <p>
9098      * The following are examples of uppercase characters:
9099      * <blockquote><pre>
9100      * 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
9101      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
9102      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
9103      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
9104      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
9105      * </pre></blockquote>
9106      * <p> Many other Unicode characters are uppercase too.
9107      *


9133      * The following are examples of uppercase characters:
9134      * <blockquote><pre>
9135      * 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
9136      * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
9137      * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
9138      * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
9139      * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
9140      * </pre></blockquote>
9141      * <p> Many other Unicode characters are uppercase too.
9142      *
9143      * @param   codePoint the character (Unicode code point) to be tested.
9144      * @return  {@code true} if the character is uppercase;
9145      *          {@code false} otherwise.
9146      * @see     Character#isLowerCase(int)
9147      * @see     Character#isTitleCase(int)
9148      * @see     Character#toUpperCase(int)
9149      * @see     Character#getType(int)
9150      * @since   1.5
9151      */
9152     public static boolean isUpperCase(int codePoint) {
9153         return CharacterData.of(codePoint).isUpperCase(codePoint) ||
9154                CharacterData.of(codePoint).isOtherUppercase(codePoint);
9155     }
9156 
9157     /**
9158      * Determines if the specified character is a titlecase character.
9159      * <p>
9160      * A character is a titlecase character if its general
9161      * category type, provided by {@code Character.getType(ch)},
9162      * is {@code TITLECASE_LETTER}.
9163      * <p>
9164      * Some characters look like pairs of Latin letters. For example, there
9165      * is an uppercase letter that looks like "LJ" and has a corresponding
9166      * lowercase letter that looks like "lj". A third form, which looks like "Lj",
9167      * is the appropriate form to use when rendering a word in lowercase
9168      * with initial capitals, as for a book title.
9169      * <p>
9170      * These are some of the Unicode characters for which this method returns
9171      * {@code true}:
9172      * <ul>
9173      * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}


9284      * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
9285      *     Arabic-Indic digits
9286      * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
9287      *     Extended Arabic-Indic digits
9288      * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
9289      *     Devanagari digits
9290      * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
9291      *     Fullwidth digits
9292      * </ul>
9293      *
9294      * Many other character ranges contain digits as well.
9295      *
9296      * @param   codePoint the character (Unicode code point) to be tested.
9297      * @return  {@code true} if the character is a digit;
9298      *          {@code false} otherwise.
9299      * @see     Character#forDigit(int, int)
9300      * @see     Character#getType(int)
9301      * @since   1.5
9302      */
9303     public static boolean isDigit(int codePoint) {
9304         return CharacterData.of(codePoint).isDigit(codePoint);
9305     }
9306 
9307     /**
9308      * Determines if a character is defined in Unicode.
9309      * <p>
9310      * A character is defined if at least one of the following is true:
9311      * <ul>
9312      * <li>It has an entry in the UnicodeData file.
9313      * <li>It has a value in a range defined by the UnicodeData file.
9314      * </ul>
9315      *
9316      * <p><b>Note:</b> This method cannot handle <a
9317      * href="#supplementary"> supplementary characters</a>. To support
9318      * all Unicode characters, including supplementary characters, use
9319      * the {@link #isDefined(int)} method.
9320      *
9321      * @param   ch   the character to be tested
9322      * @return  {@code true} if the character has a defined meaning
9323      *          in Unicode; {@code false} otherwise.
9324      * @see     Character#isDigit(char)