WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   javascript replace() (http://www.wcm.at/forum/showthread.php?t=90805)

heli2sky 10.03.2003 19:31

javascript replace()
 
Hallo!

wie kann ich mit js mehrere buchstaben eines strings ersetzen?

der string ist bei mir x

Code:

var y = x.replace(/a/g,"z");
ich will aber auch zb. alle b durch y ersetzen... wie mach ich das :confused:

käptn 10.03.2003 19:45

x = "aaabbbccc";
y = x.replace(/a/g,'x').replace(/b/g,'y').replace(/c/g,'z');

~

heli2sky 10.03.2003 20:30

danke!
 
war so einfach und doch (oder gerade deswegen???) hab ichs nicht gefunden...


Alle Zeitangaben in WEZ +2. Es ist jetzt 17:59 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag