Thanks to visit codestin.com
Credit goes to github.com

Skip to content

albertosouza/go-cnpj

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go CNPJ TestsGoDocGo version

A Go module to validate CNPJ numbers (Brazilian companies unique identifier for the Federal Revenue).

package main

import "github.com/cuducos/go-cnpj"


func main() {
	// these return true
	cnpj.IsValid("11222333000181")
	cnpj.IsValid("11.222.333/0001-81")

	// these return false
	cnpj.IsValid("11.111.111/1111-11")
	cnpj.IsValid("12.345.678 9012-34")
	cnpj.IsValid("AB.CDE.FGH/IJKL-MN")
	cnpj.IsValid("123")

	// this returns 11111111111111
	cnpj.Unmask("11.111.111/1111-11")

	// this returns 11.111.111/1111-11
	cnpj.Mask("11111111111111")
}

Based on Go CPF ❤️

About

CNPJ validation in Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%