Returns the numeric value associated with the specified
Unicode character.
[Edit]
Parameters
- c
- A Unicode character.
[Edit]
Returns
A double representing the numeric value associated with
c if and only if c has an associated numeric value;
otherwise, -1.0.
[Edit]
Remarks
Example
The following example demonstrates the char.GetNumericValue(char)
method.
C# Example |
using System;
public class GetNumericValueExample {
public static void Main() {
Char[] cAry = {'8', 'V', Convert.ToChar(0X00BC)};
//Unicode U+00BC is the code point for the character
//representation of 1/4
foreach(Char c in cAry) {
Console.Write("Numeric value of Unicode " +
"character {0} ", c);
Console.WriteLine(" is {0}",
Char.GetNumericValue(c));
}
}
}
|
The output is
Numeric value of Unicode character 8 is 8
Numeric value of Unicode character V is -1
Numeric value of Unicode character
1/4
is 0.25
Requirements
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0