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

Print this page




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


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


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




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


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


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