A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Apr 02, 2003
Feb 09, 2004 10:57:00
Does anyone know how I can take a
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.
Joined: Oct 02, 2003
Feb 09, 2004 11:12:00
you could use a stringTokenizer. check out the API here:
[ 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
Joined: Feb 07, 2004
Feb 10, 2004 05:31:00
The split() function will also work.
String full_name = "Larry Flamingo"; String names = full_name.split ( " " ); String first = names [ 0 ]; String last = names [ 1 ];
I agree. Here's the link:
subject: Splitting Strings
Split string on a word not just a character
Some String-like questions
Parsing out names from String
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014