private string Checkcidinfo (String cid)
{
string[] acity = new String[]{null,null,null,null,null,null,null,null,null,null,null, "Beijing", "Tianjin", "Hebei", "Shanxi", "Inner Mongolia", Null,null,null,null,null, "Liaoning", "Jilin", "Heilongjiang", Null,null,null,null,null,null,null, "Shanghai", "Jiangsu", "Zhejiang", "Ann Micro", "Fujian", "Jiangxi", "Shandong" , Null,null,null, "Henan", "Hubei", "Hunan", "Guangdong", "Guangxi", "Hainan", Null,null,null, "Chongqing", "Sichuan", "Guizhou", "Yunnan", "Tibet", Null,null,null,null,null , NULL, "Shaanxi", "Gansu", "Qinghai", "Ningxia", "Xinjiang", Null,null,null,null,null, "Taiwan", Null,null,null,null,null,null,null,null,null, "Hong Kong" , "Macao", Null,null,null,null,null,null,null,null, "abroad"};
Double isum=0;
String info= "";
System.Text.RegularExpressions.Regex RG = new System.Text.RegularExpressions.Regex (@ "^\d{17} (\D|X) $");
System.Text.RegularExpressions.Match MC = RG. Match (CID);
if (!MC. Success)
{
Return "";
}
CID = CID. ToLower ();
CID = CID. Replace ("X", "a");
if (acity[int. Parse (CID. Substring (0,2))]==null)
{
Return to "illegal area";
}
Try
{
DateTime.Parse (CID. Substring (6,4) + "-" +cid. Substring (10,2) + "-" +cid. Substring (12,2));
}
Catch
{
Return "Illegal birthday";
}
for (int i=17;i>=0;i--)
{
Isum + = (System.Math.Pow (2,i)%11) *int. Parse (Cid[17-i]. ToString (), System.Globalization.NumberStyles.HexNumber);
}
if (isum%11!=1)
Return ("Illegal card number");
Return (Acity[int. Parse (CID. Substring (0,2))]+ "," +cid. Substring (6,4) + "-" +cid. Substring (10,2) + "-" +cid. Substring (12,2) + "," + (int. Parse (CID. Substring (16,1))%2==1? " Male ":" female "));
}
Fully encapsulated GOOD!!! Copying to C # can be used