Java Reference
In-Depth Information
public static int
codePointCount(CharSequence seq, int start, int
end)
Returns the number of code points defined in
seq.charAt(start)
to
seq.charAt(end)
, taking into account sur-
rogate pairs. Any unpaired surrogate values count as one
code point each.
public static int
offsetByCodePoints(char[] seq, int start, int
count, int index, int numberOfCodePoints)
Returns the index into the array, that is
numberOfCodePoints
away from
index
, considering only the subarray from
seq[start]
to
seq[start+length]
, taking into account surrogate
pairs. This allows you to skip a given number of code points,
without having to manually loop through the array, keeping
track of surrogate pairs. If any unpaired surrogates are found,
they count as one code point.
public static int
offsetByCodePoints(CharSequence seq, int index,
int numberOfCodePoints)
Returns the index into the
CharSequence
, that is
number-
OfCodePoints
away from
index
, taking into account surrogate
pairs.
public static char[]
toChars(int codePoint)
Converts a code point to its
UTF
-16 representation as a one-
or two-
char
array. If
codePoint
is not valid,
IllegalArgumentEx-
ception
is thrown.
public static int
toChars(int codePoint, char[] dst, int dstBegin)
Converts a code point to its
UTF
-16 representation, storing it
in
dst
starting at
dst[dstBegin]
and returning the number of