System.Globalization.CharUnicodeInfo.GetNumericValue Method

Gets the numeric value associated with the specified character.

Syntax

public static double GetNumericValue (char ch)

Parameters

ch
The Unicode character for which to get the numeric value.

Returns

The numeric value associated with the specified character.

-or-

-1, if the specified character is not a numeric character.

Remarks

Numeric value is a Unicode character property that applies only to numeric characters, which include fractions, subscripts, superscripts, Roman numerals, currency numerators, encircled numbers, and script-specific digits. For more information on Unicode characters, see the tp://go.microsoft.com/fwlink/?linkid=37123.

The CharUnicodeInfo.GetNumericValue(char) method assumes that ch corresponds to a single linguistic character and checks whether that character can be converted to a decimal digit. However, some numbers in the Unicode standard are represented by two char objects that form a surrogate pair. For example, the Aegean numbering system consists of code points U+10107 through U+10133. The following example uses the char.ConvertFromUtf32(int) method to instantiate a string that represents AEGEAN NUMBER ONE. As the output from the example shows, the CharUnicodeInfo.GetNumericValue(char) method returns -1 if it is passed either a high surrogate or a low surrogate of this character.

code reference: System.Globalization.CharUnicodeInfo.GetNumericValue#2

Requirements

Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0