Short.ParseShort Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ParseShort(String) |
Parses the string argument as a signed decimal |
ParseShort(String, Int32) |
Parses the string argument as a signed |
ParseShort(String)
Parses the string argument as a signed decimal short
.
[Android.Runtime.Register("parseShort", "(Ljava/lang/String;)S", "")]
public static short ParseShort (string? s);
[<Android.Runtime.Register("parseShort", "(Ljava/lang/String;)S", "")>]
static member ParseShort : string -> int16
Parameters
- s
- String
a String
containing the short
representation to be parsed
Returns
the short
value represented by the
argument in decimal.
- Attributes
Exceptions
if string
cannot be parsed as a short value.
Remarks
Parses the string argument as a signed decimal short
. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-'
('\u005Cu002D'
) to indicate a negative value or an ASCII plus sign '+'
('\u005Cu002B'
) to indicate a positive value. The resulting short
value is returned, exactly as if the argument and the radix 10 were given as arguments to the #parseShort(java.lang.String, int)
method.
Java documentation for java.lang.Short.parseShort(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
ParseShort(String, Int32)
Parses the string argument as a signed short
in the
radix specified by the second argument.
[Android.Runtime.Register("parseShort", "(Ljava/lang/String;I)S", "")]
public static short ParseShort (string? s, int radix);
[<Android.Runtime.Register("parseShort", "(Ljava/lang/String;I)S", "")>]
static member ParseShort : string * int -> int16
Parameters
- s
- String
the String
containing the
short
representation to be parsed
- radix
- Int32
the radix to be used while parsing s
Returns
the short
represented by the string
argument in the specified radix.
- Attributes
Exceptions
if string
cannot be parsed as a short value, or
radix Character.MAX_RADIX
.
Remarks
Parses the string argument as a signed short
in the radix specified by the second argument. The characters in the string must all be digits, of the specified radix (as determined by whether java.lang.Character#digit(char, int)
returns a nonnegative value) except that the first character may be an ASCII minus sign '-'
('\u005Cu002D'
) to indicate a negative value or an ASCII plus sign '+'
('\u005Cu002B'
) to indicate a positive value. The resulting short
value is returned.
An exception of type NumberFormatException
is thrown if any of the following situations occurs: <ul> <li> The first argument is null
or is a string of length zero.
<li> The radix is either smaller than java.lang.Character#MIN_RADIX
or larger than java.lang.Character#MAX_RADIX
.
<li> Any character of the string is not a digit of the specified radix, except that the first character may be a minus sign '-'
('\u005Cu002D'
) or plus sign '+'
('\u005Cu002B'
) provided that the string is longer than length 1.
<li> The value represented by the string is not a value of type short
. </ul>
Java documentation for java.lang.Short.parseShort(java.lang.String, int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.