Java Reference
In-Depth Information
COMBINING_MARKS_FOR_SYMBOLS
. The
of
method will return one of these val-
ues, or
null
if the character is not in any block. For example, the code
boolean isShape =
(Character.UnicodeBlock.of(ch) ==
Character.UnicodeBlock.GEOMETRIC_SHAPES);
tests to see if a character is in the
GEOMETRIC_SHAPES
block.
Two
Subset
objects define the same Unicode subset if they are the same
object, a semantic enforced in
Subset
by declaring
equals
and
hashCode
to
be
final
, and defining them to have the default
Object
behavior for these
methods. If you define your own subsets for some reason, you should
give people a way analogous to
of
to get a single
Subset
object for each
different kind of
Subset
you define.
8.5.1. Working with
UTF
-16
Working with sequences of characters, whether arrays of
char
, strings,
ated by the fact that supplementary characters need to be encoded as
a pair of
char
values. To assist with this, the
Character
class defines a
range of methods that help with the encoding and decoding of surrog-
ate pairs, and accounting for their existence in a sequence of character
values:
public static int
charCount(int codePoint)
Returns the number of
char
values needed to encode the giv-
en code point. This returns 2 for supplementary characters,
otherwise 1.
public static int
codePointAt(char[] seq, int index)