File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " china_identification_card"
3- version = " 1.1.12 "
3+ version = " 1.1.13 "
44readme = " README.md"
55edition = " 2024"
66authors = [" root@ltpp.vip" ]
Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments