手机号码前后4位****代替

 public static string GetNotPrivlegeTelNumber(string telNumber)
        {
            string result = string.Empty;
            if (!string.IsNullOrWhiteSpace(telNumber))
            {
                result = telNumber.Length < 4 ? "****" : (telNumber.Length <= 8 ? "****" + telNumber.Substring(telNumber.Length - 4, 4) : telNumber.Substring(0, 3) + "****" + telNumber.Substring(telNumber.Length - 4, 4));
            }
            return result;
        }

猜你喜欢

转载自www.cnblogs.com/xiaz/p/9238494.html