Possible Duplicate:
what is the Java equivalent of sscanf for parsing values from a string using a known pattern?
I'm pretty new to Java, but seeing how useful the sscanf function is, I wonder if there is an equivalent in Java. I've got many pretty much formatted strings (namely, writing scripting language for my purposes), so regular expressions are overkill here.
Scanner scanner = new Scanner ("2 A text 3 4");
scanner.nextInt (); // 2
scanner.next (); // A
scanner.next (); // text
scanner.nextInt (); // 3
scanner.nextInt (); // 4
// and so on.