标签:mic one $1 详解 color span bst var 手机号
var phone=‘13511115678‘; //方法一 var newphone=phone.substr(0, 3) + ‘****‘ + phone.substr(phone.length - 4); //方法二 var newphone= phone.replace(phone.substr(3, 4),"****") //方法三 var newphone=phone.replace(/(\d{3})\d{4}(\d{4})/, ‘$1****$2‘); //方法四 var newphone=phone.replace( /([0-9]{3})([0-9]{4})([0-9]{4})/,"$1****$3")
详解方法三和四,如下:
标签:mic one $1 详解 color span bst var 手机号
原文地址:https://www.cnblogs.com/renzm0318/p/10919543.html