Tuesday, 6 August 2013

Add _ when there is a space

Add _ when there is a space

I am trying to split a string up. I need to somehow take out white space
and replace it with _
So for instance:
Jiffy Lube
but I want it to return
Jiffy_lube
Does this require regex? or do I do something like .split('').join(''); Im
not really sure any help would be very appreciated! Thank you!
Example:
Dicks Sporting Goods
return:
Dicks_Sporting_Goods

No comments:

Post a Comment