We're updating the issue view to help you get more done. 

Add additional API for numeric values

Description

Some clients would like API that access the 'numeric value' of Han code points,
even though these are not considered numeric according to Unicode. It would
also be useful to convert values to the code points in a given script.

We currently treat some Han code points as having a digit value in
getNumericValue, but this seems ill-advised. This would be a partial
replacement for changes made to that method to make it more closely conform to
the java.lang.Character semantics.

This proposes to add two new methods, one to get the numeric value for Han code
points, and one to get get the code point in a script given a numeric value.

/**

  • Return numeric value of Han code points.

  • <br> This returns the value of Han 'numeric' code points,

  • including those for zero, ten, hundred, thousand, ten thousand,

  • and hundred million. Unicode does not consider these to be

  • numeric. This includes both the standard and 'checkwriting'

  • code points, the 'big circle' zero code point, and the standard

  • zero code point.

  • @param ch code point to query

  • @return value if it is a Han 'numeric code point,' otherwise return -1.
    */
    public static int getHanNumericValue(int ch)

/**

  • Return a decimal code point in the given range for the provided value.

  • The range is defined by a DIGIT_RANGE selector, see below. Most ranges

  • only accept values between 0 and 9, some ranges (EUROPEAN_EX) accept

  • values between 0 and 35.

  • <br>

  • @param value a decimal value, from 0 to 9 for most standard ranges, and

  • from 0 to 35 for the EUROPEAN_EX ranges.

  • @param digitRange one of the DIGIT_RANGE selectors.

  • @returns the code point, or -1 if no valid code point exists for that
    decimal.
    */
    public int getCodePointForDigit(int digit, int digitRange);

/** European (ASCII) digits for values 0-9 */
public static final int DIGIT_RANGE_EUROPEAN = 0;

/** European (ASCII) digits for values 0-9 and upper case letters for values
10-35 */
public static final int DIGIT_RANGE_EUROPEAN_EX_UC = 1;

/** European (ASCII) digits for values 0-9 and lower case letters for values
10-35 */
public static final int DIGIT_RANGE_EUROPEAN_EX_LC = 2;

/** European (FullWidth) digits for values 0-9 and fullwidth upper case
letters for values 10-35 */
public static final int DIGIT_RANGE_EUROPEAN_EX_FW_UC = 3;

/** European (FullWidth) digits for values 0-9 and fullwidth lower case
letters for values 10-35 */
public static final int DIGIT_RANGE_EUROPEAN_EX_FW_LC = 4;

/** Arabic digits for values 0-9 */
public static final int DIGIT_RANGE_ARABIC = 5;

/** Eastern Arabic (Persian) digits for values 0-9 */
public static final int DIGIT_RANGE_EASTERN_ARABIC = 6;

/** Devanagari digits for values 0-9 */
public static final int DIGIT_RANGE_DEVANAGARI = 7;

/** Bengali digits for values 0-9 */
public static final int DIGIT_RANGE_BENGALI = 8;

/** Gurmukhi digits for values 0-9 */
public static final int DIGIT_RANGE_GURMUKHI = 9;

/** Gurjarati digits for values 0-9 */
public static final int DIGIT_RANGE_GUJARATI = 10;

/** Oriya digits for values 0-9 */
public static final int DIGIT_RANGE_ORIYA = 11;

/** Tamil digits for values 1-9, Tamil has no digit for zero. */
public static final int DIGIT_RANGE_TAMIL = 12;

/** Telugu digits for values 0-9 */
public static final int DIGIT_RANGE_TELUGU = 13;

/** Kannada digits for values 0-9 */
public static final int DIGIT_RANGE_KANNADA = 14;

/** Malayam digits for values 0-9 */
public static final int DIGIT_RANGE_MALAYAM = 15;

/** Thai digits for values 0-9 */
public static final int DIGIT_RANGE_THAI = 16;

/** Lao digits for values 0-9 */
public static final int DIGIT_RANGE_LAO = 17;

/** Tibetan digits for values 0-9 */
public static final int DIGIT_RANGE_TIBETAN = 18;

/** Myanmar digits for values 0-9 */
public static final int DIGIT_RANGE_MYANMAR = 19;

/** Ethiopic digits for values 0-9 */
public static final int DIGIT_RANGE_ETHIOPIC = 20;

/** Khmer digits for values 0-9 */
public static final int DIGIT_RANGE_KHMER = 21;

/** Montolian digits for values 0-9 */
public static final int DIGIT_RANGE_MONGOLIAN = 22;

/** Han digits for values 0-9 */
public static final int DIGIT_RANGE_HAN = 23;

/** Han ("checkwriting") digits for values 0-9 */
public static final int DIGIT_RANGE_HAN_CW = 24;

private static final int DIGIT_RANGE_LIMIT = 25;

Environment

Status

Assignee

Douglas Felt

Reporter

TracBot

Labels

tracCreated

Oct 05, 2001, 8:39 PM

tracOwner

doug

tracReporter

dficu4j@50cd1a9a18375803

tracResolution

fixed

tracReviewer

syn wee

tracStatus

closed

Components

Priority

assess