Struct file_scanner::Scanner [] [src]

pub struct Scanner<'a> { /* fields omitted */ }

Rust implementation of java.util.Scanner

Methods

impl<'a> Scanner<'a>
[src]

Implements the meta-methods of Scanner that affect how the data stream is processed, e.g., delimiter, parsing radix, etc.

[src]

Sets the delimiter to be some pre-compiled regex.

[src]

Sets the delimiter to be a string literal. The resulting delimiting expression is guaranteed to only interpret the literal passed in, i.e., this method cannot be used to simultaneously compile and set an arbitrary regular expression.

[src]

Return the delimiter for Scanner.next() and methods that depend on it.

[src]

Sets the radix in which numbers are parsed. This value must be on the closed range [2, 36], such that alphabet characters represent values greater than 9 in bases exceeding 10.

[src]

impl<'a> Scanner<'a>
[src]

Implements the methods of Scanner that affect the underlying data stream

[src]

Creates a new instance of Scanner on some object implementing BufRead

[src]

Returns Some(String) containing the next string if there is one. Otherwise returns None.

We first consume all leading delims, then attempt to read everything until (but excluding) the next delim. If this results in an empty string, we will return None.

[src]

Read up to (but excluding) the next \n character. If there are any leading delims, they will be included in the returned string.

NOTE: unlike next() we do consume the trailing \n, if it exists.

[src]

Attempts to retrieve the next integer of the specified (or inferred) type. Even if this fails, we still consume next.

The default radix for this parsing is 10, but users may specify a one-time arbitrary radix using Scanner.next_int_radix(u32) or persistently using Scanner.set_radix(u32).

[src]

Returns the next integer in some arbitrary base on [2, 36].

If the radix provided is outside of this range, we do nothing. Otherwise, we will consume next() even if it is not a valid integer.

NOTE: If one means to repeatedly parse in a fixed, arbitrary base, it is more efficient to use Scanner.set_radix(u32) followed by Scanner.next_int with no radix argument.

[src]

Attempts to retrieve the next floating-point number of the specified (or inferred) type. Even if this fails, we still consume next.

Note that this method is based on Scanner.next(), so the delimiter is still the same.