
Type Invocation Meaning
int compareTo(Character) Comparison using code numbers
int digit(char,int) Numeric value of the character, using the radix specified by the second argu-
ment
boolean equals(Object) Tests for equality by char value
boolean isDefined(char) Tests whether the code point is assigned
boolean isDigit(char) Tests for being a decimal digit—i.e., gc = Nd
boolean isHighSurrogate(char) Tests for being a high surrogate code unit
boolean isISOControl(char) Tests for being a C0 or C1 Control character
boolean isLetter(char) Tests whether gc is Lu, Ll, Lt, Lm, or Lo
boolean isLetterOrDigit(char) Either isLetter or isDigit returns true
boolean isLowSurrogate(char) Tests for being a high surrogate code unit
boolean isSpace(char) Tests for space character: gc is Zs, Zl, or Zp
boolean isTitleCase(char) Tests whether gc = Lt
The Preparedness Principle
Well-written program code is prepared for handling any input data, even data that
should not occur. Handling may of course consist of simply detecting an error and, for
example, skipping erroneous data silently, skipping it with a warning message, or re-
porting an error and terminating. In writing a subroutine that will not be called from
outside our program, we might consider relying on the caller to pass correct data only,
to save both programming and execution time. When writing library routines, espe-
cially if they perform complex tasks, the ...