Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base ¶ added in v0.1.1
Base returns the first 8 digits of the CNPJ number
Example (Invalid) ¶
fmt.Println(Base("123"))
Output:
Example (ValidMasked) ¶
fmt.Println(Base("11.222.333/0001-81"))
Output: 11222333
Example (ValidUnmasked) ¶
fmt.Println(Base("11222333000181"))
Output: 11222333
func CheckDigit ¶ added in v0.1.1
CheckDigit returns the last 2 digits of the CNPJ number.
Example (Invalid) ¶
fmt.Println(CheckDigit("123"))
Output:
Example (ValidMasked) ¶
fmt.Println(CheckDigit("11.222.333/0001-81"))
Output: 81
Example (ValidUnmasked) ¶
fmt.Println(CheckDigit("11222333000181"))
Output: 81
func IsValid ¶
IsValid checks whether CNPJ number is valid or not
Example (Invalid) ¶
fmt.Println(IsValid("11.111.111/1111-11"))
Output: false
Example (ValidMasked) ¶
fmt.Println(IsValid("11.222.333/0001-81"))
Output: true
Example (ValidUnmasked) ¶
fmt.Println(IsValid("11222333000181"))
Output: true
func Mask ¶
Mask returns the CNPJ number formatted
Example (Invalid) ¶
fmt.Println(Mask("42"))
Output: 42
Example (Valid) ¶
fmt.Println(Mask("11111111111111"))
Output: 11.111.111/1111-11
func Order ¶ added in v0.1.1
Order returns the 9th, 10th, 11th and 12th digits of the CNPJ number.
Example (Invalid) ¶
fmt.Println(Order("123"))
Output:
Example (ValidMasked) ¶
fmt.Println(Order("11.222.333/0001-81"))
Output: 0001
Example (ValidUnmasked) ¶
fmt.Println(Order("11222333000181"))
Output: 0001
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.