aspose file tools*
The moose likes Beginning Java and the fly likes Splitting Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitting Strings" Watch "Splitting Strings" New topic
Author

Splitting Strings

Amy Phillips
Ranch Hand

Joined: Apr 02, 2003
Posts: 280
Hi,
Does anyone know how I can take a String and split it into 2 seperate strings? I have a name string and need it to be changed into a firstname string and second name string so the split should occur at the space.
Thanks
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10916
    
  12

you could use a stringTokenizer. check out the API here:
StringTokenizer
[ February 09, 2004: Message edited by: fred rosenberger ]

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Peyton McCullough
Ranch Hand

Joined: Feb 07, 2004
Posts: 31
The split() function will also work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitting Strings
 
Similar Threads
Some String-like questions
Parsing out names from String
String Reading
splitting arrays
Split string on a word not just a character