Sdílet prostřednictvím


Character.GetNumericValue Method

Definition

Overloads

GetNumericValue(Char)

Returns the int value that the specified Unicode character represents.

GetNumericValue(Int32)

Returns the int value that the specified character (Unicode code point) represents.

GetNumericValue(Char)

Returns the int value that the specified Unicode character represents.

[Android.Runtime.Register("getNumericValue", "(C)I", "")]
public static int GetNumericValue (char ch);
[<Android.Runtime.Register("getNumericValue", "(C)I", "")>]
static member GetNumericValue : char -> int

Parameters

ch
Char

the character to be converted.

Returns

the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value but the value can not be represented as a nonnegative int value; -1 if the character has no numeric value.

Attributes

Remarks

Returns the int value that the specified Unicode character represents. For example, the character '\u005Cu216C' (the roman numeral fifty) will return an int with a value of 50.

The letters A-Z in their uppercase ('\u005Cu0041' through '\u005Cu005A'), lowercase ('\u005Cu0061' through '\u005Cu007A'), and full width variant ('\u005CuFF21' through '\u005CuFF3A' and '\u005CuFF41' through '\u005CuFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification, which does not assign numeric values to these char values.

If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.

<b>Note:</b> This method cannot handle supplementary characters. To support all Unicode characters, including supplementary characters, use the #getNumericValue(int) method.

Added in 1.1.

Java documentation for java.lang.Character.getNumericValue(char).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetNumericValue(Int32)

Returns the int value that the specified character (Unicode code point) represents.

[Android.Runtime.Register("getNumericValue", "(I)I", "")]
public static int GetNumericValue (int codePoint);
[<Android.Runtime.Register("getNumericValue", "(I)I", "")>]
static member GetNumericValue : int -> int

Parameters

codePoint
Int32

the character (Unicode code point) to be converted.

Returns

the numeric value of the character, as a nonnegative int value; -2 if the character has a numeric value but the value can not be represented as a nonnegative int value; -1 if the character has no numeric value.

Attributes

Remarks

Returns the int value that the specified character (Unicode code point) represents. For example, the character '\u005Cu216C' (the Roman numeral fifty) will return an int with a value of 50.

The letters A-Z in their uppercase ('\u005Cu0041' through '\u005Cu005A'), lowercase ('\u005Cu0061' through '\u005Cu007A'), and full width variant ('\u005CuFF21' through '\u005CuFF3A' and '\u005CuFF41' through '\u005CuFF5A') forms have numeric values from 10 through 35. This is independent of the Unicode specification, which does not assign numeric values to these char values.

If the character does not have a numeric value, then -1 is returned. If the character has a numeric value that cannot be represented as a nonnegative integer (for example, a fractional value), then -2 is returned.

Added in 1.5.

Java documentation for java.lang.Character.getNumericValue(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to