Results 1 to 3 of 3
Thread: Analyze a string of words
- 07-24-2007, 01:32 AM #1
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Analyze a string of words
Hi, I'm coding a small GUI app that analyze a string of words.
It counts the number of words and the longest words length.
I'm currently using indexOf() and substring() methods to find the first word in the string, but I am lost on how to get the second words and so on extracted.
Any ideas for this?
Thanks.
- 07-25-2007, 11:10 PM #2
Member
- Join Date
- Jul 2007
- Posts
- 55
- Rep Power
- 0
were are the strings coming from? is this provided via console or some other program. need more information to help you out.
- 07-26-2007, 10:01 AM #3
Member
- Join Date
- Jul 2007
- Location
- England, Bath
- Posts
- 47
- Rep Power
- 0
The simplest way would be to store the un-tokenised string of words in a string then use the split(" "); method of String to get an array of the words this then allows you to loop the array looking for the longest and also provides the word count as this is the array size.
Hope this helps matey.
Similar Threads
-
Extracting words from a string using delimiters
By toad in forum New To JavaReplies: 4Last Post: 07-07-2008, 01:32 PM -
The words *game* in java programming :confused:
By ibmzz in forum Advanced JavaReplies: 1Last Post: 01-23-2008, 09:23 AM -
help w words
By Gilgamesh in forum New To JavaReplies: 5Last Post: 11-21-2007, 06:15 PM -
program help: Extracting words from a string
By toad in forum New To JavaReplies: 1Last Post: 11-04-2007, 06:39 PM -
Aspose.Words for Java - 2.1.0.0
By levent in forum Java SoftwareReplies: 0Last Post: 05-24-2007, 10:08 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks