server_room
asked on
Removing white spaces in a string
I have hundreds of strings in an array that need to be seperated as in city and state
example:
*************************
Eatontown NJ
Hazlet NJ
Highland Park NJ
etc...
btw, all these strings have a variant amount of spaces :(
So I can't just do explode()
*************************
Is there a way to get these seperated?
example:
*************************
Eatontown NJ
Hazlet NJ
Highland Park NJ
etc...
btw, all these strings have a variant amount of spaces :(
So I can't just do explode()
*************************
Is there a way to get these seperated?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your solution worked! Thanks again!
Glad it helped.
ASKER
list($city, $state) = split(' + +', $stringToSplit);
Thanks!