Re: String.Replace Not Working
- From: "Evertjan." <exjxw.hannivoort@xxxxxxxxxxxx>
- Date: 10 Aug 2008 07:53:07 GMT
Dr J R Stockton wrote on 10 aug 2008 in microsoft.public.scripting.jscript:
A consequence is that one can write
S = "1,2,3,4,5,6,7,8,9".replace(/,/g, "\t")
to generate a string longer (as displayed) than its generator.
There must be more ingenious examples of using replace on a string
literal.
var s = "1,2,3,4,5,6,7,8,9";
s = s.replace(/,/g,'\n');
s = s.replace(/\d/g,function(x,y){return y+': '+y*y});
alert(s)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.
- References:
- String.Replace Not Working
- From: Brett
- Re: String.Replace Not Working
- From: Anthony Jones
- Re: String.Replace Not Working
- From: Dr J R Stockton
- String.Replace Not Working
- Prev by Date: Re: String.Replace Not Working
- Next by Date: Re: String.Replace Not Working
- Previous by thread: Re: String.Replace Not Working
- Next by thread: Re: String.Replace Not Working
- Index(es):