Scanner
might be useful here.
Better yet, Pattern
and Matcher
could be used.
See the upcoming chapters for them.
Scanner
is useful in places where
you would otherwise write an automaton.
This is because it is an automaton that you can somewhat customize
to your purposes.
You must wish to review the following topics. Click on an interesting topic to transition to its exposition.
trim()
method.