import (
"github.com/joeljunstrom/go-luhn"
"fmt"
)
// Checking if a string is a valid luhn
luhn.Valid("1234") //= false
luhn.Valid("562246784655") //= true
// Generating a valid luhn string of a specified size
randomLuhn := luhn.Generate(12)
fmt.Println(randomLuhn) //= "802252051072"
// Generating a valid luhn string of a specified size
// with a given prefix
randomLuhnWithPrefix := luhn.GenerateWithPrefix(10, "12345")
fmt.Println(randomLuhnWithPrefix) //= "1234533220"
forked from joeljunstrom/go-luhn
-
Notifications
You must be signed in to change notification settings - Fork 0
License
XUJiahua/go-luhn
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description or website provided.
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Go 100.0%