cnpj/cleaner
Values
pub fn clean_alphanumeric(cnpj: String) -> String
pub fn clean_auto(cnpj: String) -> String
Cleans a CNPJ string, automatically detecting and preserving the appropriate format.
For alphanumeric CNPJs, preserves letters and numbers (A-Z, 0-9) and converts to uppercase. For numeric CNPJs, preserves only numbers (0-9).
Examples
clean_auto("12.ABC.345/01DE-35") // "12ABC34501DE35"
clean_auto("84.980.771/0001-82") // "84980771000182"
pub fn format_auto(cnpj: String) -> String
Formats a CNPJ string, automatically detecting the format type.
Alphanumeric CNPJs are formatted as: “AA.AAA.AAA/AAAA-DD” Numeric CNPJs are formatted as: “99.999.999/9999-99”
Examples
format_auto("12ABC34501DE35") // "12.ABC.345/01DE-35"
format_auto("84980771000182") // "84.980.771/0001-82"
pub fn has_letters(str: String) -> Bool