This is not unlike the capabilities of the StringTokenizer and Scanner classes in Java.
Of course, you can't count on tokens being nicely delimited in program input; for example, given the string x:=3+foo-(AnotherID/123.4) you need to be able to extract the tokens x, := (note that this is just one token), 3, +, foo, -, (, AnotherID, /, 123.4, and ). There is another ML function that can help you with this:
fun foo #"*" = "**" | foo #" " = "" | foo c = str c; String.translate foo "a * b*c" => "a**b**c"