不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
手机号码类型判断[2011-11-17更新]
编辑:dnawo 日期:2009-02-05
复制内容到剪贴板
程序代码

/// <summary>
/// 手机号码类型判断
/// </summary>
/// <param name="mobile">手机号码</param>
/// <returns>
/// 返回值:
/// 1 移动手机号码
/// 2 联通手机号码
/// 3 电信手机号码
/// 4 固定电话、小灵通
/// 0 未知
/// </returns>
static int CardType(string mobile)
{
//移动电话
if (Regex.IsMatch(mobile, @"^\d{11}$") && mobile.Substring(0, 1) != "0")
{
switch (mobile.Substring(0, 3))
{
case "134":
case "135":
case "136":
case "137":
case "138":
case "139":
case "147"://3g,数据卡
case "150":
case "151":
case "152":
case "157"://3g
case "158":
case "159":
case "182":
case "183":
case "187"://3g
case "188"://3g
return 1;
case "130":
case "131":
case "132":
case "145"://3g,数据卡
case "155":
case "156":
case "185"://3g,预留
case "186"://3g
return 2;
case "133":
case "153":
case "180"://3g
case "189"://3g
return 3;
default:
return 0;
}
}
//固定电话
else if (Regex.IsMatch(mobile, @"^\d{3,4}-{0,1}\d{7,8}$"))
return 4;
//未知
else
return 0;
}
/// 手机号码类型判断
/// </summary>
/// <param name="mobile">手机号码</param>
/// <returns>
/// 返回值:
/// 1 移动手机号码
/// 2 联通手机号码
/// 3 电信手机号码
/// 4 固定电话、小灵通
/// 0 未知
/// </returns>
static int CardType(string mobile)
{
//移动电话
if (Regex.IsMatch(mobile, @"^\d{11}$") && mobile.Substring(0, 1) != "0")
{
switch (mobile.Substring(0, 3))
{
case "134":
case "135":
case "136":
case "137":
case "138":
case "139":
case "147"://3g,数据卡
case "150":
case "151":
case "152":
case "157"://3g
case "158":
case "159":
case "182":
case "183":
case "187"://3g
case "188"://3g
return 1;
case "130":
case "131":
case "132":
case "145"://3g,数据卡
case "155":
case "156":
case "185"://3g,预留
case "186"://3g
return 2;
case "133":
case "153":
case "180"://3g
case "189"://3g
return 3;
default:
return 0;
}
}
//固定电话
else if (Regex.IsMatch(mobile, @"^\d{3,4}-{0,1}\d{7,8}$"))
return 4;
//未知
else
return 0;
}
说明:由于普通手机号码可到营业厅不换号,换张新手机卡即可升级为3G,所以不能单纯从号码来判断用户属于2G还是3G!
移动、联通和电信最新号段
移动:134、135、136、137、138、139、147(3g,数据卡)、150、151、152、157(3g)、158、159、182、183、187(3g)、188(3g)
联通:130、131、132、145(3g,数据卡)、155、156、185(3g,预留)、186(3g)
电信:133、153、180(3g)、189(3g)






评论: 0 | 引用: 0 | 查看次数: 4686
发表评论
请登录后再发表评论!