1、java
String mobile = "11122223333"; String substringStart = mobile.substring(0, 3); //获取前面三位数字 String substringEnd = mobile.substring(7,mobile.length()); String strMobile = substringStart+"****"+substringEnd; //获取后面四位数字
2、jquery
var str = "11122223333"; var tel = str.toString().substr(0, 3)+‘****‘+str.toString().substr(7); //str为所求结果
原文地址:https://www.cnblogs.com/g-smile/p/9149536.html
时间: 2024-11-08 23:39:34