Js、 replace 全部内容替换、替换全部匹配内容、替换第一个
Js、 replace 全部内容替换、替换全部匹配内容、替换第一个_FameLee-的博客-CSDN博客_js替换使用jquery的replace时,发现只默认替换到第一个匹配数据。string str =“12333”1、替换第一个:string end =str.replace(3,"2")结果:122332、替换全部匹配内容:string end =str.replace(/3/g,"2")“g”是匹配全部的意思,这样str里面的所有数字3,都替换成数字2。结果:122223...https:/...
复制链接