Converts a String to an Int32.
[Visual Basic] Overloads Public Shared Function Parse( _ ByVal s As String _ ) As Integer [C#] public static int Parse( string s ); [C++] public: static int Parse( String* s ); [JScript] public static function Parse( s : String ) : int;
An Int32 with the value represented by s.
Exception Type | Condition |
---|---|
ArgumentNullException | If s is a null reference (in Visual Basic Nothing). |
FormatException | If s is not a real number. |
OverflowException | If s represents a number that is less than MinValue or greater than MaxValue. |
The string is parsed according to the NumberFormatInfo object associated with the CultureInfo of the current thread, and the permitted style from Integer of NumberStyles.
In order to make a conversion, the s parameter should be a string of a sequence of digits with an optional leading sign. Leading and trailing white space is permitted, but ignored.
Note Hexadecimal strings ("0x42") are not supported. Use Value or Convert ToIntxx(string, int) and ToUIntxx methods for the conversions.
Note The Parse methods do not accept not a number (NaN) or positive or negative infinity.
Int32 Structure | Int32 Members | System Namespace | Int32.Parse Overload List | String | Value | Convert | MaxValue | MinValue | NaN | NaN | PositiveInfinity | PositiveInfinity | NegativeInfinity | NegativeInfinity