format static method

String format(
  1. String cpf
)

Formats the standard 11 digits cpf.

Example unformatted CPF: 12345678912 Formatted output: 123.456.789-12

Implementation

static String format(String cpf) {
  return "${cpf.substring(0, 3)}.${cpf.substring(3, 6)}.${cpf.substring(6, 9)}-${cpf.substring(9)}";
}