解决办法:js里没有replaceall函数,因此需要用正则表示,关于回车换行的正则表示/\r\n|\n/g
(g为全局标志)
string.replace(/source/g,
string.replace(new
string:字符串表达式包含要替代的子字符串。
source:被搜索的子字符串。
replaceWith:用于替换的子字符串。
解决办法:js里没有replaceall函数,因此需要用正则表示,关于回车换行的正则表示/\r\n|\n/g
(g为全局标志)
string.replace(/source/g,
string.replace(new
string:字符串表达式包含要替代的子字符串。
source:被搜索的子字符串。
replaceWith:用于替换的子字符串。
下一篇:我的友情链接
JS替换功能函数,用正则表达式解决,js的全部替换,学习js的朋友可以参考下。alert("abacacf".replace('a','9')); alert("abacacf".re
1.JS replace()方法替换变量(可以对变量进行全文替换) 2.封装 .
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M