就用replace就可以
C#里也是这么用的

解决方案 »

  1.   

    呵呵,fason(阿信)好像一直就在CSDN上泡着,什么问题都是第一个回答
    :)
      

  2.   

    javascript没有像vbscript那样强大的字串处理函数,只好用正则来作了
      

  3.   


    str = "abcdefg";第一种方法:str = str.substring(0,2)+str.substring(5,7);  substring(firstIndex,lastIndex):返回字符串,此字符串等价于以firstIndex开始并以lastIndex之前的字符结束的子串。如果firstIndex大于lastIndex,则字符串以lastIndex开始并以firstIndex之前的字符作结尾。第二种方法: 同fason(阿信)  str = str.replace(/cde/g,"");  replace(regular_expression,newSubStr):查找并用newSubStr替换reguar_expression。