27 lines
676 B
C#
27 lines
676 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Admin.NET.Core
|
|
{
|
|
public class MarkPhoneUtil
|
|
{
|
|
/// <summary>
|
|
/// 手机号中间四位用*号隐藏
|
|
/// </summary>
|
|
/// <param name="phoneNumber"></param>
|
|
/// <returns></returns>
|
|
public static string MaskPhoneNumber(string phoneNumber)
|
|
{
|
|
if (string.IsNullOrEmpty(phoneNumber) || phoneNumber.Length != 11)
|
|
{
|
|
return phoneNumber;
|
|
}
|
|
return phoneNumber.Substring(0, 3) + "****" + phoneNumber.Substring(7);
|
|
}
|
|
}
|
|
|
|
}
|