StringTokenizer is very useful when you need to play with the tokens of some text. Follow the example below:

Java Code:
String s = "My string message.";
StringTokenizer st = new StringTokenizer(s, " ");
while (st.hasMoreTokens()) {
    System.out.println(st.nextToken());
}