var myphone = phone.substr(3, 4); var lphone = phone.replace(myphone, "****"); 思路: 1.截取中间四位。 2.用星号将中间四位替换。 转载于:https://www.cnblogs.com/hinux/p/10445369.html