# 字符串操作

  • 多个字符串替换多个字符串
function replaceAll(str,mapObj){
    var re = new RegExp(Object.keys(mapObj).join("|"),"gi");

    return str.replace(re, function(matched){
        return mapObj[matched.toLowerCase()];
    });
}
Last Updated: 5/14/2022, 11:38:45 AM