中国移动服务网号 "134", "135", "136", "137", "138", "139", "147","150", "151", "152", "157", "158", "159", "182","183","187", "188"
中国联通服务网号 "130", "131", "132", "145","155", "156","186", "185"
中国电信服务网号 "133", "153", "180", "181", "189"
/// <summary> /// 获取判断手机运营商 /// </summary> /// <param name="mobile"></param> /// <returns></returns> public static string validateMobile(string mobile) { String returnString = ""; if (mobile == null || mobile.Trim().Length != 11) { return "-1"; //mobile参数为空或者手机号码长度不为11,错误! } if (mobile.Trim().Substring(0, 3).Equals("134") || mobile.Trim().Substring(0, 3).Equals("135") || mobile.Trim().Substring(0, 3).Equals("136") || mobile.Trim().Substring(0, 3).Equals("137") || mobile.Trim().Substring(0, 3).Equals("138") || mobile.Trim().Substring(0, 3).Equals("139") || mobile.Trim().Substring(0, 3).Equals("150") || mobile.Trim().Substring(0, 3).Equals("151") || mobile.Trim().Substring(0, 3).Equals("152") || mobile.Trim().Substring(0, 3).Equals("157") || mobile.Trim().Substring(0, 3).Equals("158") || mobile.Trim().Substring(0, 3).Equals("159") || mobile.Trim().Substring(0, 3).Equals("182") || mobile.Trim().Substring(0, 3).Equals("183") || mobile.Trim().Substring(0, 3).Equals("187") || mobile.Trim().Substring(0, 3).Equals("188") || mobile.Trim().Substring(0, 3).Equals("147")) { returnString = "1"; //中国移动 } if (mobile.Trim().Substring(0, 3).Equals("130") || mobile.Trim().Substring(0, 3).Equals("131") || mobile.Trim().Substring(0, 3).Equals("132") || mobile.Trim().Substring(0, 3).Equals("145") || mobile.Trim().Substring(0, 3).Equals("155") || mobile.Trim().Substring(0, 3).Equals("156") || mobile.Trim().Substring(0, 3).Equals("185") || mobile.Trim().Substring(0, 3).Equals("186")) { returnString = "2"; //中国联通 } if (mobile.Trim().Substring(0, 3).Equals("133") || mobile.Trim().Substring(0, 3).Equals("153") || mobile.Trim().Substring(0, 3).Equals("180") || mobile.Trim().Substring(0, 3).Equals("181") || mobile.Trim().Substring(0, 3).Equals("189")) { returnString = "3"; //中国电信 } if (returnString.Trim().Equals("")) { returnString = "0"; //未知运营商 } return returnString; } /// <summary> /// 判断三大运营商 移动、联通、电信 /// </summary> /// <param name="mobile"></param> /// <returns></returns> public string GetMobileType(string mobile) { string result = ""; if (mobile == null || mobile.Trim().Length != 11) { return "-1"; //mobile参数为空或者手机号码长度不为11,错误! } if (mobile.StartsWith("0") || mobile.StartsWith("+860")) { mobile = mobile.Substring(mobile.IndexOf("0") + 1, mobile.Length); } //中国移动服务网号 ArrayList ChinaMobile = ArrayList.Adapter(new string[] {"134", "135", "136", "137", "138", "139", "147","150", "151", "152", "157", "158", "159", "182","183","187", "188" }); //中国联通服务网号 ArrayList ChinaUnicom = ArrayList.Adapter(new string[] { "130", "131", "132", "145","155", "156", "186", "185" }); //中国电信服务网号 ArrayList ChinaTelecom = ArrayList.Adapter(new string[] { "133", "153", "180", "181", "189" }); bool bolChinaMobile = (ChinaMobile.Contains(mobile.Substring(0, 3))); bool bolChinaUnicom = (ChinaUnicom.Contains(mobile.Substring(0, 3))); bool bolChinaTelecom = (ChinaTelecom.Contains(mobile.Substring(0, 3))); if (bolChinaMobile) return result="1"; // 移动 if (bolChinaUnicom ) return result="2"; // 联通 if (bolChinaTelecom) return result="3"; // 电信 if (result.Trim().Equals("")) { result = "0"; //未知运营商 } return result; }