码迷,mamicode.com
首页 > Web开发 > 详细

js replace

时间:2017-05-25 17:17:30      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:替换   line   fga   new   height   忽略   str   style   ace   

var str="abcdafgahiAbcAfgAhi";

var newstr = str.replace("a","o");  //obcdafgahiAbcAfgAhi (只替换一次)

newstr = str.replace(/a/g,"o");  //obcdofgohiAbcAfgAhi (g代表全局)

newstr = str.replace(/a/gi,"o");  //obcdofgohiobcofgohi (i代表忽略大小写)

 

js replace

标签:替换   line   fga   new   height   忽略   str   style   ace   

原文地址:http://www.cnblogs.com/ndgail/p/6904807.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!