1.replaceAll
使用正则表达式g
注意正则表达式不用引号,用/
str = "Please visit Microsoft and Microsoft!";
var n = str.replace(/Microsoft/g, "W3School");
console.log(n);
使用正则表达式g
注意正则表达式不用引号,用/
str = "Please visit Microsoft and Microsoft!";
var n = str.replace(/Microsoft/g, "W3School");
console.log(n);
本文标题:00013.字符串操作(整理中)
本文链接:https://www.haomeiwen.com/subject/fuhilrtx.html
网友评论