摘要: replace是一个很好用的方法,但是我却一直害怕用它。原因是它里面有涉及到正则,今天来看看能突破到哪一个地步。首先,来看看它的语法:newstring=str.replace(regexp|substr,newSubStr|function[,Non-standardflags]);来一个比较简单的例子先,var str = "He said,Hello world.";var newString = str.replace(/He/g,'he'); // ==> he said, hello world.这个最简单的用法,没有用到正则,没有函数。只 阅读全文
posted @ 2012-12-06 10:36 e.e.p 阅读(211) 评论(0) 推荐(0) 编辑