Faqts : Computers : Programming : Languages : JavaScript : Language Core : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 3 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

say this variable $worlds has "red hat server" how can I make this change two "red+hat+server"

Oct 12th, 2001 02:09
Jean-Bernard Valentaten, paul smith,


Well, you can use a regular expression (RegExp) and the method replace
().
It should work like this:
var world;
world = "red hat server"
world = world.replace(/\s/, "+")
where /\s/ means any whitespace, so be carefull.
HTH