#validate #cpf #cnpj #validador

cpf_cnpj

针对 Rust 的 CPF 和 CNPJ 验证器

4 个版本

0.2.1 2020 年 6 月 27 日
0.2.0 2020 年 6 月 27 日
0.1.1 2020 年 6 月 23 日
0.1.0 2020 年 6 月 23 日

#6#cpf

Download history • Rust 包仓库 20/week @ 2024-04-04 • Rust 包仓库 12/week @ 2024-04-11 • Rust 包仓库 4/week @ 2024-04-25 • Rust 包仓库 6/week @ 2024-05-09 • Rust 包仓库 10/week @ 2024-05-16 • Rust 包仓库 34/week @ 2024-05-23 • Rust 包仓库 38/week @ 2024-05-30 • Rust 包仓库 18/week @ 2024-06-06 • Rust 包仓库 11/week @ 2024-06-13 • Rust 包仓库 45/week @ 2024-06-20 • Rust 包仓库 33/week @ 2024-06-27 • Rust 包仓库 33/week @ 2024-07-04 • Rust 包仓库 102/week @ 2024-07-11 • Rust 包仓库 74/week @ 2024-07-18 • Rust 包仓库

252 每月下载量

MIT 许可证

9KB
153 行代码

cpf_cnpj

为 Rust 提供的 CPF 和 CNPJ 验证器和生成器。

Crates.ioCrates.ioBuild StatusAPI

以下是一些重要的特性

  • 分析重复的数字,如 111.111.111-11000.000.000-00
  • 忽略特殊字符。
  • 提前验证数字的位数。

安装

将以下依赖项添加到您的 Cargo.toml

[dependencies]
cpf_cnpj = "0.1.0"

基本用法

以下是一个使用此库的简单示例

extern crate cpf_cnpj;

use cpf_cnpj::cpf;
use cpf_cnpj::cnpj;

cpf::validate("255.248.930-33");
// true

cpf::validate("25524893033");
// true

cpf::validate("99999999999");
// false

cnpj::validate("36.002.518/0001-01");
// true

cnpj::validate("36002518000101");
// true

cpf::generate();
// 25524893033

cnpj::generate();
// 76071265000142

许可证

cpf_cnpj 是一个开源软件,由 MIT 许可。

依赖项

~520KB