This is validator, generator and formats the brazil code as CPF and CNPJ
Formats to use
- CPF
- CNPJ
- CNH
- VoterRegistration(Título de Eleitor)
Import package with command in shell
$ go get github.com/estrategiahq/brazilcode
In code just use the function with import
Example:
package main
import (
"fmt"
"github.com/estrategiahq/brazilcode"
)
func main() {
doc, err := brazilcode.CNPJGenerate()
if err != nil {
panic(err)
}
docFormatted, err := brazilcode.CNPJFormat(doc)
if err != nil {
panic(err)
}
fmt.Println(doc, docFormatted)
}
The MIT License © 2023 João Vitor Lima da Rocha