package
module
Version:
v0.0.0-...-3dc418f
Opens a new window with list of versions in this module.
Published: Mar 31, 2024
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Luhn Algorithm
Generating check number & validating Luhn numbers in GO
Usage
import "https://github.com/vasilenkodm/luhn"
func main() {
// Checking if a string is a valid luhn
luhn.Valid(1111) //= false
luhn.Valid(79927398713) //= true
luhn.CalculateLuhn(7992739871) //= 3
}
Documentation
¶
func CalculateLuhn[T Number](number T) T
CalculateLuhn return the check number
Valid check number is valid or not based on Luhn algorithm
Source Files
¶
Click to show internal directories.
Click to hide internal directories.