to top
Android APIs
public class

AndroidCharacter

extends Object
java.lang.Object
   ↳ android.text.AndroidCharacter

Class Overview

AndroidCharacter exposes some character properties that are not easily accessed from java.lang.Character.

Summary

Constants
int EAST_ASIAN_WIDTH_AMBIGUOUS
int EAST_ASIAN_WIDTH_FULL_WIDTH
int EAST_ASIAN_WIDTH_HALF_WIDTH
int EAST_ASIAN_WIDTH_NARROW
int EAST_ASIAN_WIDTH_NEUTRAL
int EAST_ASIAN_WIDTH_WIDE
Public Constructors
AndroidCharacter()
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int EAST_ASIAN_WIDTH_AMBIGUOUS

Since: API Level 8

Constant Value: 1 (0x00000001)

public static final int EAST_ASIAN_WIDTH_FULL_WIDTH

Since: API Level 8

Constant Value: 3 (0x00000003)

public static final int EAST_ASIAN_WIDTH_HALF_WIDTH

Since: API Level 8

Constant Value: 2 (0x00000002)

public static final int EAST_ASIAN_WIDTH_NARROW

Since: API Level 8

Constant Value: 4 (0x00000004)

public static final int EAST_ASIAN_WIDTH_NEUTRAL

Since: API Level 8

Constant Value: 0 (0x00000000)

public static final int EAST_ASIAN_WIDTH_WIDE

Since: API Level 8

Constant Value: 5 (0x00000005)

Public Constructors

public AndroidCharacter ()

Since: API Level 1

Public Methods

public static void getDirectionalities (char[] src, byte[] dest, int count)

Since: API Level 1

Fill in the first 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)

Since: API Level 8
Parameters
input the character to measure
Returns
  • the East Asian Width for input

public static void getEastAsianWidths (char[] src, int start, int count, byte[] dest)

Since: API Level 8

Fill the first 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.

Parameters
src character array of input to measure
start first character in array to measure
count maximum number of characters to measure
dest byte array of results for each character in src

public static char getMirror (char ch)

Since: API Level 1

Return the right-to-left mirror (or the original char if none) of the specified char.

public static boolean mirror (char[] text, int start, int count)

Since: API Level 1

Replace the specified slice of text with the chars' right-to-left mirrors (if any), returning true if any replacements were made.

Parameters
text array of characters to apply mirror operation
start first character in array to mirror
count maximum number of characters to mirror
Returns
  • true if replacements were made