public class AndroidCharacter extends Object
Modifier and Type | Field and Description |
---|---|
static int |
EAST_ASIAN_WIDTH_AMBIGUOUS |
static int |
EAST_ASIAN_WIDTH_FULL_WIDTH |
static int |
EAST_ASIAN_WIDTH_HALF_WIDTH |
static int |
EAST_ASIAN_WIDTH_NARROW |
static int |
EAST_ASIAN_WIDTH_NEUTRAL |
static int |
EAST_ASIAN_WIDTH_WIDE |
Constructor and Description |
---|
AndroidCharacter() |
Modifier and Type | Method and Description |
---|---|
static void |
getDirectionalities(char[] src,
byte[] dest,
int count)
Fill in the first
count bytes of dest with the
directionalities from the first count chars of src . |
static int |
getEastAsianWidth(char input)
Calculate the East Asian Width of a character according to
Unicode TR#11.
|
static void |
getEastAsianWidths(char[] src,
int start,
int count,
byte[] dest)
Fill the first
count bytes of dest with the
East Asian Width from count chars of src
starting at start . |
static char |
getMirror(char ch)
Return the right-to-left mirror (or the original char if none)
of the specified char.
|
static boolean |
mirror(char[] text,
int start,
int count)
Replace the specified slice of
text with the chars'
right-to-left mirrors (if any), returning true if any
replacements were made. |
public static final int EAST_ASIAN_WIDTH_NEUTRAL
public static final int EAST_ASIAN_WIDTH_AMBIGUOUS
public static final int EAST_ASIAN_WIDTH_HALF_WIDTH
public static final int EAST_ASIAN_WIDTH_FULL_WIDTH
public static final int EAST_ASIAN_WIDTH_NARROW
public static final int EAST_ASIAN_WIDTH_WIDE
public static void getDirectionalities(char[] src, byte[] dest, int count)
count
bytes of dest
with the
directionalities from the first count
chars of src
.
This is just like Character.getDirectionality() except it is a
batch operation.public static int getEastAsianWidth(char input)
EAST_ASIAN_WIDTH_NEUTRAL
,
EAST_ASIAN_WIDTH_AMBIGUOUS
, EAST_ASIAN_WIDTH_HALF_WIDTH
,
EAST_ASIAN_WIDTH_FULL_WIDTH
, EAST_ASIAN_WIDTH_NARROW
,
or EAST_ASIAN_WIDTH_WIDE
.input
- the character to measurepublic static void getEastAsianWidths(char[] src, int start, int count, byte[] dest)
count
bytes of dest
with the
East Asian Width from count
chars of src
starting at start
. East Asian Width is calculated based on
Unicode TR#11. Each entry
in dest
will be one of EAST_ASIAN_WIDTH_NEUTRAL
,
EAST_ASIAN_WIDTH_AMBIGUOUS
, EAST_ASIAN_WIDTH_HALF_WIDTH
,
EAST_ASIAN_WIDTH_FULL_WIDTH
, EAST_ASIAN_WIDTH_NARROW
,
or EAST_ASIAN_WIDTH_WIDE
.src
- character array of input to measurestart
- first character in array to measurecount
- maximum number of characters to measuredest
- byte array of results for each character in srcpublic static boolean mirror(char[] text, int start, int count)
text
with the chars'
right-to-left mirrors (if any), returning true if any
replacements were made.text
- array of characters to apply mirror operationstart
- first character in array to mirrorcount
- maximum number of characters to mirrorpublic static char getMirror(char ch)