Splits a string into tokens.