Sdílet prostřednictvím


Character.Digit Method

Definition

Overloads

Digit(Char, Int32)

Returns the numeric value of the character ch in the specified radix.

Digit(Int32, Int32)

Returns the numeric value of the specified character (Unicode code point) in the specified radix.

Digit(Char, Int32)

Returns the numeric value of the character ch in the specified radix.

[Android.Runtime.Register("digit", "(CI)I", "")]
public static int Digit (char ch, int radix);
[<Android.Runtime.Register("digit", "(CI)I", "")>]
static member Digit : char * int -> int

Parameters

ch
Char

the character to be converted.

radix
Int32

the radix.

Returns

the numeric value represented by the character in the specified radix.

Attributes

Remarks

Returns the numeric value of the character ch in the specified radix.

If the radix is not in the range MIN_RADIX &le; radix &le; MAX_RADIX or if the value of ch is not a valid digit in the specified radix, -1 is returned. A character is a valid digit if at least one of the following is true: <ul> <li>The method isDigit is true of the character and the Unicode decimal digit value of the character (or its single-character decomposition) is less than the specified radix. In this case the decimal digit value is returned. <li>The character is one of the uppercase Latin letters 'A' through 'Z' and its code is less than radix + 'A' - 10. In this case, ch - 'A' + 10 is returned. <li>The character is one of the lowercase Latin letters 'a' through 'z' and its code is less than radix + 'a' - 10. In this case, ch - 'a' + 10 is returned. <li>The character is one of the fullwidth uppercase Latin letters A ('\u005CuFF21') through Z ('\u005CuFF3A') and its code is less than radix + '\u005CuFF21' - 10. In this case, ch - '\u005CuFF21' + 10 is returned. <li>The character is one of the fullwidth lowercase Latin letters a ('\u005CuFF41') through z ('\u005CuFF5A') and its code is less than radix + '\u005CuFF41' - 10. In this case, ch - '\u005CuFF41' + 10 is returned. </ul>

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

Java documentation for java.lang.Character.digit(char, 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

Digit(Int32, Int32)

Returns the numeric value of the specified character (Unicode code point) in the specified radix.

[Android.Runtime.Register("digit", "(II)I", "")]
public static int Digit (int codePoint, int radix);
[<Android.Runtime.Register("digit", "(II)I", "")>]
static member Digit : int * int -> int

Parameters

codePoint
Int32

the character (Unicode code point) to be converted.

radix
Int32

the radix.

Returns

the numeric value represented by the character in the specified radix.

Attributes

Remarks

Returns the numeric value of the specified character (Unicode code point) in the specified radix.

If the radix is not in the range MIN_RADIX &le; radix &le; MAX_RADIX or if the character is not a valid digit in the specified radix, -1 is returned. A character is a valid digit if at least one of the following is true: <ul> <li>The method #isDigit(int) isDigit(codePoint) is true of the character and the Unicode decimal digit value of the character (or its single-character decomposition) is less than the specified radix. In this case the decimal digit value is returned. <li>The character is one of the uppercase Latin letters 'A' through 'Z' and its code is less than radix + 'A' - 10. In this case, codePoint - 'A' + 10 is returned. <li>The character is one of the lowercase Latin letters 'a' through 'z' and its code is less than radix + 'a' - 10. In this case, codePoint - 'a' + 10 is returned. <li>The character is one of the fullwidth uppercase Latin letters A ('\u005CuFF21') through Z ('\u005CuFF3A') and its code is less than radix + '\u005CuFF21' - 10. In this case, codePoint - '\u005CuFF21' + 10 is returned. <li>The character is one of the fullwidth lowercase Latin letters a ('\u005CuFF41') through z ('\u005CuFF5A') and its code is less than radix + '\u005CuFF41'- 10. In this case, codePoint - '\u005CuFF41' + 10 is returned. </ul>

Added in 1.5.

Java documentation for java.lang.Character.digit(int, 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