/ ** /
///
public
Static
String
Getrandomcode
int
Number
{String [] arrlist = new string [] {"0", "1", "2", "3", "4", "6", "8", "9" , "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", " M "," n "," o "," p "," q "," r "," s "," t "," u "," w "," x "," y "," z " }; Stringbuilder sb = new stringbuilder (""); random random = new random (); for (int i = 0; i / ** / /// public Static int GetMobileType String Mobile) {String [] chinaunicom = new string [] {"130", "131", "132", "133"}; string [] chinamobile1 = new string [] {"135", "136", "137", "138", "139"}; string [] chinamobile2 = new string [] {"1340", "1341", "1342", "1343", "1344", "1345", "1346", "1347" , "1348"}; Bool BolchinaUnicom = (Array.indexof (ChinaUnicom, Mobile.Substring (0, 3))> = 0); Bool BolchinAmobile1 = (Array.indexof (chinAmobile1, mobile.substring (0, 3))> = 0); Bool BolchinAmobile2 = (Array.indexof (chinAmobile2)> = 0); if (BolchinaUnicom) Return 1; // Unicom IF (BolchinAmobile1 || BolchinaMobile2) Return 2; // Mobile Return 3; // Other as telecom} Note: There are friends suggest that the second method is better, it is really good, it is true, the new implementation of the second method is attached: / ** / /// public Static int GetMobileType String Mobile) {IF (ischinaUnicomnumber (Mobile) Return 1; IF (ischinamobilenumber (mobile)) Return 2; Return 3; // Whether it is Unicom's number test Private Static Bool IschinaUnicomnumber String Mobile) {String Spattern = "^ (130 | 131 | 132 | 133) [0-9] {8}"; BOOL IschinaUnicom = regex.ismatch (Mobile, spattern); return ischinaunicom;} // Is it a mobile number test Private Static Bool Ischinamobilenumber ( String Mobile) {String Spattern = "(135 | 136 | 137 | 138 | 139 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348) [1-9] {7,8}"; Return Regex. Ismatch (mobile, spattern);