This article is a mirror article of machine translation, please click here to jump to the original article.

View: 25485|Reply: 3

[Source] C# hides the mobile phone number in the form of the middle 4 digits hidden with *

[Copy link]
Posted on 12/21/2015 3:43:00 PM | | |
If you use sql to do it directly~~ you can do it like this~~
  1. select isnull(stuff(user_phone,4,4,'****'),'游客') as user_phone from tbl_user
Copy code
If you do it in the program~~ then do it like this~~


  1. public string StuffPhone(string _phone)
  2.     {
  3.         string result = string.Empty;
  4.         if (_phone.Length == 11)
  5.         {
  6.             result = _phone.Insert(3, "****").Remove(7, 4);
  7.         }
  8.         else
  9.         {
  10.             result = "手机号无效";
  11.         }
  12.         return result;
  13.     }
Copy code






Previous:Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.Ensure...
Next:Go home tonight and try two wireless route trunk setups
Posted on 12/21/2015 3:53:15 PM |
Posted on 12/24/2015 9:43:03 AM |
                    
Posted on 5/15/2019 5:53:42 PM |
Good
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com