Scanner.NextShort 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
NextShort() |
Scans the next token of the input as a |
NextShort(Int32) |
Scans the next token of the input as a |
NextShort()
Scans the next token of the input as a short
.
[Android.Runtime.Register("nextShort", "()S", "")]
public short NextShort ();
[<Android.Runtime.Register("nextShort", "()S", "")>]
member this.NextShort : unit -> int16
Returns
the short
scanned from the input
- Attributes
Exceptions
if this Scanner
has been closed.
if input has been exhausted.
if the next token can not be translated into a valid
short
value.
Remarks
Scans the next token of the input as a short
.
An invocation of this method of the form nextShort()
behaves in exactly the same way as the invocation #nextShort(int) nextShort(radix)
, where radix
is the default radix of this scanner.
Java documentation for java.util.Scanner.nextShort()
.
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
NextShort(Int32)
Scans the next token of the input as a short
.
[Android.Runtime.Register("nextShort", "(I)S", "")]
public short NextShort (int radix);
[<Android.Runtime.Register("nextShort", "(I)S", "")>]
member this.NextShort : int -> int16
Parameters
- radix
- Int32
the radix used to interpret the token as a short value
Returns
the short
scanned from the input
- Attributes
Exceptions
if this Scanner
has been closed.
if input has been exhausted.
if the next token can not be translated into a valid
short
value.
Remarks
Scans the next token of the input as a short
. This method will throw InputMismatchException
if the next token cannot be translated into a valid short value as described below. If the translation is successful, the scanner advances past the input that matched.
If the next token matches the <i>Integer</i> regular expression defined above then the token is converted into a short
value as if by removing all locale specific prefixes, group separators, and locale specific suffixes, then mapping non-ASCII digits into ASCII digits via Character#digit Character.digit
, prepending a negative sign (-) if the locale specific negative prefixes and suffixes were present, and passing the resulting string to Short#parseShort(String, int) Short.parseShort
with the specified radix.
If the radix is less than Character#MIN_RADIX Character.MIN_RADIX
or greater than Character#MAX_RADIX Character.MAX_RADIX
, then an IllegalArgumentException
is thrown.
Java documentation for java.util.Scanner.nextShort(.*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.