Next: Equality testing. Up: Strings. Previous: The String class.
Another useful method to know about is the parseInt() class method in the Integer class. It takes a String as a parameter and returns the corresponding integer value.
This puts the value 563 into the value variable.int value = Integer.parseInt("563");
There's also a Double.parseDouble() method that works the same way, except for double values.
The IO class provides two ways of reading a string from the user. The IO.readLine() method returns a string containing all the letters of a line, while the IO.readString() method returns the next word. (Actually, IO.readString() returns the next string of non-whitespace characters it finds - so the word can contain a mix of letters, digits, and punctuation.)
Next: Equality testing. Up: Strings. Previous: The String class.