Skip to content

Commit 9d23013

Browse files
committed
feat: v1.1.13
1 parent 039dd90 commit 9d23013

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "china_identification_card"
3-
version = "1.1.12"
3+
version = "1.1.13"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["root@ltpp.vip"]

src/chinese_id_card/impl.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ impl ChineseIdCard {
1313
/// - `bool` - Validation result.
1414
pub fn is_valid_id_number<T: ToString>(id_number: T) -> bool {
1515
let id_number_string: String = id_number.to_string();
16-
if id_number_string.len() != 18 || !id_number_string[..17].chars().all(|c| c.is_digit(10)) {
16+
if id_number_string.len() != 18
17+
|| !id_number_string[..17].chars().all(|c| c.is_ascii_digit())
18+
{
1719
return false;
1820
}
1921
let last_char: char = id_number_string.chars().last().unwrap();
20-
if !(last_char.is_digit(10) || last_char == 'X') {
22+
if !(last_char.is_ascii_digit() || last_char == 'X') {
2123
return false;
2224
}
2325
let sum: i32 = id_number_string[..17]

0 commit comments

Comments
 (0)