Converts a String to a Single with the default format.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String _ ) As Single [C#] public static float Parse( string s ); [C++] public: static float Parse( String* s ); [JScript] public static function Parse( s : String ) : float;
Returns the Single value of the string parameter.
Exception Type | Condition |
---|---|
ArgumentNullException | If the string is a null reference (in Visual Basic Nothing). |
FormatException | If the string is not a real number. |
It is not acceptable for the s parameter to contain the expressions of "123.12 e5" and "123.12e 5".
The s parameter should match one of the following regular expressions:
Leading and trailing white space characters are ignored.
The Parse method does not throw a FormatException if the string is not a number (see NaN); it returns NaN instead. Nor does it throw an OverflowException; it returns PositiveInfinity or NegativeInfinity if the number is too large or too small.
Single Structure | Single Members | System Namespace | Single.Parse Overload List | FromString | ToString