Freigeben über


Scanner.NextLong Method

Definition

Overloads

NextLong()

Scans the next token of the input as a long.

NextLong(Int32)

Scans the next token of the input as a long.

NextLong()

Scans the next token of the input as a long.

[Android.Runtime.Register("nextLong", "()J", "")]
public long NextLong ();
[<Android.Runtime.Register("nextLong", "()J", "")>]
member this.NextLong : unit -> int64

Returns

the long 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 long value.

Remarks

Scans the next token of the input as a long.

An invocation of this method of the form nextLong() behaves in exactly the same way as the invocation nextLong(radix), where radix is the default radix of this scanner.

Java documentation for java.util.Scanner.nextLong().

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

NextLong(Int32)

Scans the next token of the input as a long.

[Android.Runtime.Register("nextLong", "(I)J", "")]
public long NextLong (int radix);
[<Android.Runtime.Register("nextLong", "(I)J", "")>]
member this.NextLong : int -> int64

Parameters

radix
Int32

the radix used to interpret the token as an int value

Returns

the long 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 long value.

Remarks

Scans the next token of the input as a long. This method will throw InputMismatchException if the next token cannot be translated into a valid long 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 long 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 Long#parseLong(String, int) Long.parseLong 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.nextLong(.*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.

Applies to