aspose file tools*
The moose likes Beginning Java and the fly likes Splitting a string to smaller strings. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitting a string to smaller strings." Watch "Splitting a string to smaller strings." New topic
Author

Splitting a string to smaller strings.

James Palmer
Ranch Hand

Joined: Mar 15, 2004
Posts: 36
Hello, i have a big string with lots of words in it and i want to find a way to split this string into separate words.This probably means that whenever the program finds a space it means that this is a new word and should make a new string for that one until it meets a space again.Particularly i want to use a tokenizer to do this.For example the string "I have a cat" should be split in 4 strings."I" "have" "a" "cat".Can anyone help?
john smith
Ranch Hand

Joined: Mar 04, 2004
Posts: 75
From the API javadoc:
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
You can learn more about the StringTokenizer here


- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
David Peterson
author
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
Alternatively use the split() method of String class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitting a string to smaller strings.