版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/My_ben/article/details/83985462
获取身份证中的性别,代码如下:
public static bool GetGenderByIdCard(string idCard)
{
if (string.IsNullOrWhiteSpace(idCard))
{
return false;
}
return Convert.ToBoolean(int.Parse(idCard.Substring(16, 1)) % 2);
}