Java Reference
In-Depth Information
Display 5.8
Some Methods in the Class
Character
(part 2 of 2)
public static boolean
isUpperCase(
char
argument)
Returns
true
if its
argument
is an uppercase letter; otherwise returns
false
.
EXAMPLE
Character.isUpperCase('A')
returns
true
.
Character.isUpperCase('a')
and
Character.isUpperCase('%')
both return
false
.
public static boolean
isLowerCase(
char
argument)
Returns
true
if its
argument
is a lowercase letter; otherwise returns
false
.
EXAMPLE
Character.isLowerCase('a')
returns
true
.
Character.isLowerCase('A')
and
Character.isLowerCase('%')
both return
false
.
public static boolean
isWhitespace(
char
argument)
Returns
true
if its
argument
is a whitespace character; otherwise returns
false
.
Whitespace char-
acters are those that print as white space, such as the space character (blank character), the tab char-
acter (
'\t'
), and the line break character (
'\n'
).
EXAMPLE
Character.isWhitespace(' ')
returns
true
.
Character.isWhitespace('A')
returns
false
.
public static boolean
isLetter(
char
argument)
Returns
true
if its
argument
is a letter; otherwise returns
false
.
EXAMPLE
Character.isLetter('A')
returns
true
.
Character.isLetter('%')
and
Character.
isLetter ('5')
both return
false
.
public static boolean
isDigit(
char
argument)
Returns
true
if its
argument
is a digit; otherwise returns
false
.
EXAMPLE
Character.isDigit('5')
returns
true
.
Character.isDigit('A')
and
Character.
is Digit('%')
both return
false
.
public static boolean
isLetterOrDigit(
char
argument)
Returns
true
if its
argument
is a letter or a digit; otherwise returns
false
.
EXAMPLE
Character.isLetterOrDigit('A')
and
Character.isLetterOrDigit('5')
both return
true
.
Character.isLetterOrDigit('&')
returns
false
.