< prev index next >

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

Print this page




9549      * nonnegative integer (for example, a fractional value), then -2
9550      * is returned.
9551      *
9552      * @param   codePoint the character (Unicode code point) to be converted.
9553      * @return  the numeric value of the character, as a nonnegative {@code int}
9554      *          value; -2 if the character has a numeric value but the value
9555      *          can not be represented as a nonnegative {@code int} value;
9556      *          -1 if the character has no numeric value.
9557      * @see     Character#forDigit(int, int)
9558      * @see     Character#isDigit(int)
9559      * @since   1.5
9560      */
9561     public static int getNumericValue(int codePoint) {
9562         return CharacterData.of(codePoint).getNumericValue(codePoint);
9563     }
9564 
9565     /**
9566      * Determines if the specified character is ISO-LATIN-1 white space.
9567      * This method returns {@code true} for the following five
9568      * characters only:
9569      * <table summary="truechars">


9570      * <tr><td>{@code '\t'}</td>            <td>{@code U+0009}</td>
9571      *     <td>{@code HORIZONTAL TABULATION}</td></tr>
9572      * <tr><td>{@code '\n'}</td>            <td>{@code U+000A}</td>
9573      *     <td>{@code NEW LINE}</td></tr>
9574      * <tr><td>{@code '\f'}</td>            <td>{@code U+000C}</td>
9575      *     <td>{@code FORM FEED}</td></tr>
9576      * <tr><td>{@code '\r'}</td>            <td>{@code U+000D}</td>
9577      *     <td>{@code CARRIAGE RETURN}</td></tr>
9578      * <tr><td>{@code ' '}</td>  <td>{@code U+0020}</td>
9579      *     <td>{@code SPACE}</td></tr>

9580      * </table>
9581      *
9582      * @param      ch   the character to be tested.
9583      * @return     {@code true} if the character is ISO-LATIN-1 white
9584      *             space; {@code false} otherwise.
9585      * @see        Character#isSpaceChar(char)
9586      * @see        Character#isWhitespace(char)
9587      * @deprecated Replaced by isWhitespace(char).
9588      */
9589     @Deprecated(since="1.1")
9590     public static boolean isSpace(char ch) {
9591         return (ch <= 0x0020) &&
9592             (((((1L << 0x0009) |
9593             (1L << 0x000A) |
9594             (1L << 0x000C) |
9595             (1L << 0x000D) |
9596             (1L << 0x0020)) >> ch) & 1L) != 0);
9597     }
9598 
9599 




9549      * nonnegative integer (for example, a fractional value), then -2
9550      * is returned.
9551      *
9552      * @param   codePoint the character (Unicode code point) to be converted.
9553      * @return  the numeric value of the character, as a nonnegative {@code int}
9554      *          value; -2 if the character has a numeric value but the value
9555      *          can not be represented as a nonnegative {@code int} value;
9556      *          -1 if the character has no numeric value.
9557      * @see     Character#forDigit(int, int)
9558      * @see     Character#isDigit(int)
9559      * @since   1.5
9560      */
9561     public static int getNumericValue(int codePoint) {
9562         return CharacterData.of(codePoint).getNumericValue(codePoint);
9563     }
9564 
9565     /**
9566      * Determines if the specified character is ISO-LATIN-1 white space.
9567      * This method returns {@code true} for the following five
9568      * characters only:
9569      * <table>
9570      * <caption style="display:none">truechars</caption>
9571      * <tbody>
9572      * <tr><td>{@code '\t'}</td>            <td>{@code U+0009}</td>
9573      *     <td>{@code HORIZONTAL TABULATION}</td></tr>
9574      * <tr><td>{@code '\n'}</td>            <td>{@code U+000A}</td>
9575      *     <td>{@code NEW LINE}</td></tr>
9576      * <tr><td>{@code '\f'}</td>            <td>{@code U+000C}</td>
9577      *     <td>{@code FORM FEED}</td></tr>
9578      * <tr><td>{@code '\r'}</td>            <td>{@code U+000D}</td>
9579      *     <td>{@code CARRIAGE RETURN}</td></tr>
9580      * <tr><td>{@code ' '}</td>  <td>{@code U+0020}</td>
9581      *     <td>{@code SPACE}</td></tr>
9582      * </tbody>
9583      * </table>
9584      *
9585      * @param      ch   the character to be tested.
9586      * @return     {@code true} if the character is ISO-LATIN-1 white
9587      *             space; {@code false} otherwise.
9588      * @see        Character#isSpaceChar(char)
9589      * @see        Character#isWhitespace(char)
9590      * @deprecated Replaced by isWhitespace(char).
9591      */
9592     @Deprecated(since="1.1")
9593     public static boolean isSpace(char ch) {
9594         return (ch <= 0x0020) &&
9595             (((((1L << 0x0009) |
9596             (1L << 0x000A) |
9597             (1L << 0x000C) |
9598             (1L << 0x000D) |
9599             (1L << 0x0020)) >> ch) & 1L) != 0);
9600     }
9601 
9602 


< prev index next >