www.webdeveloper.com
Results 1 to 3 of 3

Thread: js:replace dont work:(

Hybrid View

  1. #1
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    js:replace dont work:(

    why this isnt working :
    x="abcdeee";
    x.replace("e","z");
    alert("1:"+x);

    even whne i do this :

    x="abcdeee";
    x.replace("z","r");
    alert("2:"+x);

    doesnt work!!!why???

  2. #2
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    The replace method does not modify the string it works on, but rather returns a new string. So...

    x = x.replace("e","z");
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The first argument has to be a regular expression.
    Code:
    re = /e/gi;
    str = "abcdeee";
    newstr=str.replace(re, "z");
    document.write(newstr);
    The result is "abcdzzz"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles