1 Star 0 Fork 0

wosylf/龙飞工具仓库

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
身份证验证.go 470 Bytes
Copy Edit Raw Blame History
longfei authored 2024-07-16 14:22 +08:00 . 优化一下结构
package xutil
import (
"strconv"
"strings"
)
func F判断身份证号是否异常(sfz string) bool {
if len(sfz) != 18 {
return false
}
strArr1 := strings.Split(sfz, "")
xy := strings.Split("1,0,X,9,8,7,6,5,4,3,2", ",")
strArr3 := strings.Split("7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2", ",")
n := 0
for k, v := range strArr3 {
n += num(strArr1[k]) * num(v)
}
return xy[n%11] == strArr1[17]
}
func num(s string) (n int) {
n, _ = strconv.Atoi(s)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wosylf/ltool.git
git@gitee.com:wosylf/ltool.git
wosylf
ltool
龙飞工具仓库
4aab2f4b94f9

Search