utils/format
Types
Cache structure to hold precompiled regular expressions This improves performance by avoiding recompilation on every validation
pub type RegexCache {
RegexCache(
formatted_cpf: regexp.Regexp,
unformatted_cpf: regexp.Regexp,
formatted_cnpj: regexp.Regexp,
unformatted_cnpj: regexp.Regexp,
formatted_alphanumeric_cnpj: regexp.Regexp,
unformatted_alphanumeric_cnpj: regexp.Regexp,
)
}
Constructors
-
RegexCache( formatted_cpf: regexp.Regexp, unformatted_cpf: regexp.Regexp, formatted_cnpj: regexp.Regexp, unformatted_cnpj: regexp.Regexp, formatted_alphanumeric_cnpj: regexp.Regexp, unformatted_alphanumeric_cnpj: regexp.Regexp, )
Values
pub fn all_characteres_are_equal(str: String) -> Bool
pub fn build_regex_cache() -> RegexCache
Build a cache with all precompiled regular expressions This should be called once and reused for multiple validations
pub fn format_cnpj(cnpj: String) -> String
pub fn format_cpf(cpf: String) -> String
pub fn formatted_alphanumeric_cnpj_regex() -> regexp.Regexp
pub fn formatted_cnpj_regex() -> regexp.Regexp
pub fn formatted_cpf_regex() -> regexp.Regexp
pub fn unformatted_alphanumeric_cnpj_regex() -> regexp.Regexp
pub fn unformatted_cnpj_regex() -> regexp.Regexp
pub fn unformatted_cpf_regex() -> regexp.Regexp