Hi I'm trying to replace commas in a string with spaces, it works for the first instance of a commas. but I dont know how to remove the rest:
Code:var aString = "Humpty,Dumpty,sat,on,a,wall"; document.write(aString.replace(","," "));
Hi I'm trying to replace commas in a string with spaces, it works for the first instance of a commas. but I dont know how to remove the rest:
Code:var aString = "Humpty,Dumpty,sat,on,a,wall"; document.write(aString.replace(","," "));
The g means 'global'Code:var aString = "Humpty,Dumpty,sat,on,a,wall"; document.write(aString.replace(/,/g, ' '));
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thank you very much
Bookmarks