时间:2020-11-18 01:19:15 | 栏目:.NET代码 | 点击:次
如下所示:
String subStr=phone.Substring(3,4); oldcellphone.Text = phone.Replace(subStr,"****"); /// <summary> /// 替换手机号中间四位为* /// </summary> /// <param name="phoneNo"></param> /// <returns></returns> protected string ReturnPhoneNO(string phoneNo) { Regex re = new Regex("(\\d{3})(\\d{4})(\\d{4})", RegexOptions.None); phoneNo = re.Replace(phoneNo, "$1****$3"); return phoneNo; }