Discovered splits method, what to do with more then 1 space

Wirloff

Member
Joined
Mar 2, 2005
Messages
19
Location
Belgium
Programming Experience
1-3
Hi,

I'm able of splitting a string lik "Hallo, my name is.." with the "split method"
But what to do if there are more than one space between the words????

split(string, " ") only works if there's exactly one space between them... I've been searching for a couple of houres now :(

Anyone who can help?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Hmm yes it puts blinks into the array. You could either use an arraylist and .removeat(.indexof("")) or before you split you could replace(" ", " ") which would make the double spaces single.
TPM
 
Top Bottom