using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Text.RegularExpressions;
|
|
namespace SmsSendTool
|
{
|
public class MobileUtils
|
{
|
/// <summary>
|
/// 号段
|
/// </summary>
|
/// <returns></returns>
|
public static string MobileNo(string mobile)
|
{
|
if (mobile.Length < 4)
|
{
|
return "";
|
}
|
|
string haoduan = mobile.Substring(0, 3);
|
switch (haoduan)
|
{
|
case "134": return "yd";
|
case "135": return "yd";
|
case "136": return "yd";
|
case "137": return "yd";
|
case "138": return "yd";
|
case "139": return "yd";
|
case "147": return "yd";
|
case "148": return "yd";
|
case "150": return "yd";
|
case "151": return "yd";
|
case "152": return "yd";
|
case "157": return "yd";
|
case "158": return "yd";
|
case "159": return "yd";
|
case "182": return "yd";
|
case "183": return "yd";
|
case "184": return "yd";
|
case "187": return "yd";
|
case "188": return "yd";
|
case "178": return "yd";
|
case "172": return "yd";
|
case "198": return "yd";
|
case "130": return "lt";
|
case "131": return "lt";
|
case "132": return "lt";
|
case "155": return "lt";
|
case "156": return "lt";
|
case "166": return "lt";
|
case "185": return "lt";
|
case "186": return "lt";
|
case "145": return "lt";
|
case "146": return "lt";
|
case "171": return "lt";
|
case "176": return "lt";
|
case "175": return "lt";
|
case "133": return "dx";
|
case "153": return "dx";
|
case "180": return "dx";
|
case "181": return "dx";
|
case "189": return "dx";
|
case "177": return "dx";
|
case "173": return "dx";
|
case "174": return "dx";
|
case "149": return "dx";
|
case "191": return "dx";
|
case "199": return "dx";
|
case "170": return Get170(mobile);
|
default: return "yd";
|
}
|
}
|
|
/// <summary>
|
/// 170号段
|
/// </summary>
|
/// <returns></returns>
|
private static string Get170(string phone)
|
{
|
string haoduan = phone.Substring(0, 4);
|
switch (haoduan)
|
{
|
case "1703": return "yd";
|
case "1705": return "yd";
|
case "1706": return "yd";
|
case "1704": return "lt";
|
case "1707": return "lt";
|
case "1708": return "lt";
|
case "1709": return "lt";
|
case "1700": return "dx";
|
case "1701": return "dx";
|
case "1702": return "dx";
|
default: return "yd";
|
}
|
}
|
|
|
#region 判断是否是正确的手机号码格式
|
/// <summary>
|
/// 判断是否是正确的手机号码格式
|
/// </summary>
|
/// <param name="txtPhone">手机号码</param>
|
/// <returns></returns>
|
public static bool IsPhone(string txtPhone)
|
{
|
string s = @"^(1(([34579689][0-9])|(47)|[8][01236789]))\d{8}$";
|
return Regex.IsMatch(txtPhone, s);
|
}
|
#endregion
|
}
|
}
|