See Also: Scanner Members
A parser that parses a text string of primitive types and strings with the help of regular expressions. This class is not as useful as it might seem. It's very inefficient for communicating between machines; you should use JSON, protobufs, or even XML for that. Very simple uses might get away with Java.Lang.String.Split(string). For input from humans, the use of locale-specific regular expressions make it not only expensive but also somewhat unpredictable.
This class supports localized numbers and various radixes. The input is broken into tokens by the delimiter pattern, which is \\p{javaWhitespace} by default.
Example:
java Example
Scanner s = new Scanner("1A true"); assertEquals(26, s.nextInt(16)); assertEquals(true, s.nextBoolean());
The Scanner class is not thread-safe.