Thread: help w words
View Single Post
  #2 (permalink)  
Old 11-21-2007, 12:27 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
You can use String methods to break up the string into words.
You can use a StringTokenizer to break it into tokens; this is an older way.
You can use the split method to break up the string into an array of words. The challenge here is to use the correct Pattern. This is the newer way. See the Pattern class for options.
Maybe something like this:
Code:
String str = stringFromReadingInTheFile. String[] words = str.split("\\b(\\s+)\\b");
Reply With Quote