23.07.2013 Views

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Java</strong> I/O<br />

two Latin letters. In uppercase they are D , LJ, NJ, and DZ. In lowercase they are d , lj, nj,<br />

and dz. In title case they are D , Lj, Nj, and Dz. The isUpperCase() method returns true if<br />

the specified character is defined as uppercase; isLowerCase()returns true if the specified<br />

character is defined as lowercase; and isTitleCase()returns true if the specified character<br />

is defined as title case by the Unicode specification.<br />

public static boolean isLowerCase(char c)<br />

public static boolean isUpperCase(char c)<br />

public static boolean isTitleCase(char c)<br />

Many characters are neither uppercase nor lowercase. For instance, both<br />

Character.isLowerCase('7') and Character.isUpperCase('7') return false. The<br />

Devanagari script used for Hindi, Sanskrit, and some other languages of the Indian<br />

subcontinent does not have upper- and lowercases. The toUpperCase(), toLowerCase(), and<br />

toTitleCase() methods return the upper-, lower-, and title case equivalents of the specified<br />

character:<br />

public static char toLowerCase(char c)<br />

public static char toUpperCase(char c)<br />

public static char toTitleCase(char c)<br />

For example:<br />

character upperA = Character.toUpperCase('a');<br />

Not all letters and certainly not all characters have upper-, lower-, or title case equivalents. If<br />

the specified character does not have an upper-, lower-, or title case equivalent, then the<br />

unmodified character itself is returned.<br />

The isDigit() method returns true if its argument is a digit in any character set. This<br />

includes not just the usual ASCII digits through 9 but digits from Arabic, Devanagari,<br />

Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Lao, Malayalam, Thai, and<br />

Tibetan.<br />

public static boolean isDigit(char ch)<br />

The isLetterOrDigit() method returns true if the specified character is either a Unicode<br />

letter or a Unicode digit as determined by the isLetter() and isDigit() methods:<br />

public static boolean isLetterOrDigit(char c)<br />

The isSpaceChar() method returns true if Unicode defines the specified character as a<br />

space character:<br />

public static boolean isSpaceChar(char c)<br />

Space characters include ASCII spaces (32) but do not include some characters you might<br />

expect, like carriage returns, tabs, or linefeeds.<br />

351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!