Package com.cafintech.assembly.entity;
Import Com.alibaba.fastjson.JSONObject;
/** * Created by 15600 on 2017/8/7. * * public class Judgeoperator {/* 1, mobile number 134,135,136,137, 138,139,147,150,151, 152,157,158,159,178,182,183,184,18
7,188.
2, China Unicom number of 130,131,132,155,156,185,186,145,176.
3, the electrical signal section has 133,153,177.173,180,181,189. */static String YD = "^[1]{1}" ([3]{1}[4-9]{1}) | ( [5] {1} [012789] {1}) | ([8]{1}[23478]{1}) | ([4]{1}[7]{1}) | ([7]{1}[8]{1})] [0-9]
{8}$ "; static String LT = "^[1]{1}" ([3]{1}[0-2]{1}) | ( [5] {1} [56] {1}) | ([8]{1}[56]{1}) | ([4]{1}[5]{1}) | ([7]{1}[6]{1})] [0-9]
{8}$ "; static String DX = "^[1]{1}" ([3]{1}[3]{1}) | ( [5] {1} [3] {1}) | ([8]{1}[09]{1}) | ([7]{1}[37]{1})] [0-9]
{8}$ "; Public Judgeoperator () {} public static string Matchnum (String mobphnnum) {/** * entry: Mobile phone number *re Turn param * Code (INT): 200 phone number meets the requirements code:500 mobile phone number is not required * type (int): 1:yd 2:lt 3:dx/J
Sonobject jsonobject=new jsonobject (); // Determine if the mobile phone number is 11-bit if (mobphnnum.length () = = 11) {//Determine if the phone number is in line with China Mobile's number rule if (mobphnnum.matches (YD))
{Jsonobject.put ("code", 200);
Jsonobject.put ("type", 1); //Determine if the mobile phone number is in accordance with China Unicom number rule else if (mobphnnum.matches (LT)) {jsonobject.put ("code", 2
00);
Jsonobject.put ("type", 2); //Determine if the phone number is in line with China Telecom's number rule else if (mobphnnum.matches (DX)) {jsonobject.put ("code", 2
00);
Jsonobject.put ("type", 3);
}//is not suitable for unknown else {jsonobject.put ("code", 500);
}//Not 11-bit else {jsonobject.put ("code", 500);
return jsonobject.tostring ();
}
}