标签:nbsp turn span ring news return class str 一个
直接上函数吧 不废话
function replacestring(oldstr,newstr,text) { var exp = new RegExp(oldstr,‘g‘); var c=text.replace(exp,newstr); return c; } var oldstr=‘world‘; var newstr=‘cccc‘; var text=‘Hello world, Hello world‘; var aa= replacestring(oldstr,newstr,text); console.log(aa);
标签:nbsp turn span ring news return class str 一个
原文地址:https://www.cnblogs.com/baker95935/p/11330879.html