Export (0) Print
Expand All

Char.GetNumericValue Method

Converts a specified numeric Unicode character to a double-precision floating point number.

Overload List

Converts the specified numeric Unicode character to a double-precision floating point number.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Function GetNumericValue(Char) As Double
[C#] public static double GetNumericValue(char);
[C++] public: static double GetNumericValue(__wchar_t);
[JScript] public static function GetNumericValue(Char) : double;

Converts the numeric Unicode character at the specified position in a specified string to a double-precision floating point number.

[Visual Basic] Overloads Public Shared Function GetNumericValue(String, Integer) As Double
[C#] public static double GetNumericValue(string, int);
[C++] public: static double GetNumericValue(String*, int);
[JScript] public static function GetNumericValue(String, int) : double;

Example

[Visual Basic, C#, C++] The following sample demonstrates GetNumericValue.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of GetNumericValue. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Imports System

Module GetNumericValueSample

    Sub Main()

        Dim str As String
        str = "input: 1"

        Console.WriteLine(Char.GetNumericValue("8"c))       ' Output: "8"
        Console.WriteLine(Char.GetNumericValue(str, 7))     ' Output: "1"

    End Sub

End Module

[C#] 
using System;

public class GetNumericValueSample {
    public static void Main() {
        string str = "input: 1";

        Console.WriteLine(Char.GetNumericValue('8'));        // Output: "8"
        Console.WriteLine(Char.GetNumericValue(str, 8));    // Output: "1"
    }
}

[C++] 
#using <mscorlib.dll>
using namespace System;

int main() {
   String* str = "input: 1";

   Console::WriteLine(Char::GetNumericValue('8'));    // Output: "8"
   Console::WriteLine(Char::GetNumericValue(str, 7)); // Output: "1"
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Char Structure | Char Members | System Namespace

Show:
© 2014 Microsoft