移动、联通和电信运营商最新号段判断
2014-06-30 00:00
239 查看
/** * 判断号码是联通,移动,电信中的哪个, * 在使用本方法前,请先验证号码的合法性 规则: * * 中国移动拥有号码段为:139,138,137,136,135,134,147,159,158,157(3G),151,152,150,182(3G),188(3G),187(3G);16个号段 * 中国联通拥有号码段为:130,131,132,145,155,156(3G),186(3G),185(3G);8个号段 * 中国电信拥有号码段为:133,1349,153,189(3G),180(3G);5个号码段 * @param mobile要判断的号码 * @return 返回相应类型:1代表联通;2代表移动;3代表电信 */ public String getMobileType(String mobile) { if (mobile.startsWith("0") || mobile.startsWith("+860")) { mobile = mobile.substring(mobile.indexOf("0") + 1, mobile.length()); } List chinaUnicom = Arrays.asList(new String[] { "130", "131", "132", "145","155", "156", "186", "185" }); List chinaMobile1 = Arrays.asList(new String[] { "135", "136", "137", "138", "139", "147","150", "151", "152", "157", "158", "159", "182","187", "188" }); List chinaMobile2 = Arrays.asList(new String[] { "1340", "1341", "1342", "1343", "1344", "1345", "1346", "1347", "1348" }); boolean bolChinaUnicom = (chinaUnicom.contains(mobile.substring(0, 3))); boolean bolChinaMobile1 = (chinaMobile1 .contains(mobile.substring(0, 3))); boolean bolChinaMobile2 = (chinaMobile2 .contains(mobile.substring(0, 4))); if (bolChinaUnicom) return "1";//联通 if (bolChinaMobile1 || bolChinaMobile2) return "2"; //移动 return "3"; //其他为电信 }
相关文章推荐
- 移动、联通和电信运营商最新号段判断
- 判断手机所属三大运营商 移动、联通、电信
- 两种方式判断移动运营商(移动,联通,电信)[原创]
- JavaScript判断手机号运营商是移动、联通、电信还是其他(代码简单)
- android上获取imsi码,判断运营商信息(移动,联通,电信)
- 移动联通和电信的号段判断
- 判断手机号码属于哪个地区 哪个运营商(移动、联通、电信、)
- JavaScript判断手机号运营商是移动、联通、电信还是其他(代码简单
- 黑莓行货手机是否都有运营商(移动,电信,联通)的logo?
- iOS 获取手机sim卡的运营商(移动,电信,联通) 相关信息
- 移动联通电信wap和net接入点判断
- 移动联通电信wap和net接入点判断
- 最新的电信移动联通手机号段分配情况
- php正则匹配手机号,区分运营商,区分联通、移动、电信,mysql匹配手机号
- android 获取IMSI信息(判断是移动,联通,电信手机卡)
- 判断手机号码是否合法(移动,联通,电信)
- 如何判断手机用户是移动,电信,联通?
- 移动联通电信wap和net接入点判断
- Android通讯录开发之获取运营商号码段(移动、联通、电信)