Skip to content

rafalgolarz/iban-luhn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Go Report Card codebeat badge CircleCI GoDoc

iban-luhn

Go libraries for validating banking data (account or card numbers)

func IsIBAN(account string) bool

Returns true if account is a valid IBAN number

func FormatIBAN(iban string, verify bool) (formatted string, err error)

Returns formatted IBAN. If verify is set to true, perform IBAN validation first (by calling IsIBAN)

func IsLuhn(number string) bool

Returns true if number passes the Luhn validation

Running the example

Follow instructions to install go. Once you have Go up and running, you can download, build and run the example using the following commands.

$ go get github.com/rafalgolarz/iban-luhn/accounts

or

$ go get github.com/rafalgolarz/iban-luhn/cards

then, assuming you have $GOPATH environmental variable set

$ cd $GOPATH/src/github.com/rafalgolarz/iban-luhn
$ go run example.go

Running tests

$ cd $GOPATH/src/github.com/rafalgolarz/iban-luhn/accounts
$ go test -v
$ go test -bench=.
$ go test -count 4 -benchmem -bench=.

$ cd $GOPATH/src/github.com/rafalgolarz/bankingo/cards
$ go test -v
$ go test -bench=.
$ go test -count 4 -benchmem -bench=.

About

Verify IBAN and Luhn (used in financial operations)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages