如下所示: String subStr=phone.Substring(3,4);oldcellphone.Text = phone.Replace(subStr,"****"); /// summary /// 替换手机号中间四位为* /// /summary /// param name="phoneNo"/param /// returns/returns protected string ReturnPhon
如下所示:
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; }
以上这篇浅谈C#手机号换成111XXXX1111 这种显示的解决思路就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。