js 替换部分内容为星号

function formatPhone(phone) {
            return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
        }

姓名显示最后一个字,其余用星号代替
‘实打实的‘.replace(/.(?=.)/g, ‘*);

return new Array(str.length).join(‘*) + str.substr(-1);
文章来自:http://www.cnblogs.com/yanyd/p/5606675.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3