utilsbr/cpf/cleaner

Values

pub fn clean(cpf: String) -> String

Cleans a given CPF string by removing all non-numeric characters.

This function takes a CPF string as input and keeps only the digits (0-9), returning the cleaned CPF string.

Examples

let cleaned_cpf = clean("123.456.789-09")
assert cleaned_cpf == "12345678909"

Arguments

  • cpf - A string representing the CPF to be cleaned.

Returns

A new string containing only the numeric characters from the input CPF.

Search Document