Expand description
CEP (Código de Endereçamento Postal) - validation, formatting and generation.
Brazilian postal codes are 8 digits with no check digit. Validation is
structural (8 numeric characters, optionally formatted as XXXXX-XXX)
plus optional region/state lookup by range.
Structs§
- Cep
- A validated CEP stored as 8 ASCII bytes.
Enums§
- CepError
- Postal
Region - Postal region mapped by the first digit of a CEP.
Functions§
- format_
cep - Formats as
#####-###, orNoneif not 8 digits. - generate
- Generates a random valid CEP as an 8-digit string.
- generate_
cep - Generates a random valid
Cep. - generate_
for_ region - Generates a random
Cepfor a given postal region (1st digit fixed). - generate_
for_ state - Generates a random
Cepwithin the range of a given state. - is_
valid - is_
valid_ strict - Strict validation - accepts
#####-###or########only. - remove_
symbols