Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-24-2007, 03:32 AM
zoe zoe is offline
Member
 
Join Date: Jul 2007
Posts: 40
zoe is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-26-2007, 01:10 AM
Member
 
Join Date: Jul 2007
Posts: 55
Seemster is on a distinguished road
were are the strings coming from? is this provided via console or some other program. need more information to help you out.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-26-2007, 12:01 PM
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
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.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting words from a string using delimiters toad New To Java 4 07-07-2008 03:32 PM
The words *game* in java programming :confused: ibmzz Advanced Java 1 01-23-2008 11:23 AM
help w words Gilgamesh New To Java 5 11-21-2007 08:15 PM
program help: Extracting words from a string toad New To Java 1 11-04-2007 08:39 PM
Aspose.Words for Java - 2.1.0.0 levent Java Announcements 0 05-24-2007 12:08 PM


All times are GMT +3. The time now is 11:19 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org