luhn

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 0 Imported by: 0

README

Luhn

一、这是什么?

一个银行卡校验算法,用于离线计算银行卡是否合法,关于Luhn的详情请移步https://www.cnblogs.com/cc11001100/p/9357177.html

二、安装

go get -u github.com/golang-infrastructure/go-Luhn

三、示例

package main

import (
	"fmt"
	luhn "github.com/golang-infrastructure/go-Luhn"
)

func main() {
	b := luhn.Check("8703008427912866")
	fmt.Println(b)
	// Output:
	// true

	b = luhn.Check("8703008427912861")
	fmt.Println(b)
	// Output:
	// false
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(cardNumber string) bool

Check 检查银行卡号是否合法

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL