Skip to content

ISO/IEC 7064:2003 Go implementation

License

Notifications You must be signed in to change notification settings

jacoelho/go-iso7064

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ISO/IEC 7064:2003

GoDoc

Check character system implementation in Go as described in ISO/IEC 7064:2003.

Instalation

go get -u github.com/jacoelho/go-iso7064/iso7064

Usage

Import:

import "github.com/jacoelho/go-iso7064/iso7064"

Usage

iso7064.Modulo11Radix2("079")
// output: "X"

More examples in godoc.

Normalise

Check systems are not validating if the input is within the expected values, if required, the following function are provided:

iso7064.NormaliseNumeric("1A3 4")
// output: "134"
iso7064.NormaliseAlphabetic("aB1c")
// output: "ABC"
iso7064.NormaliseAlphaNumeric("aB1 c")
// output: "AB1C"

Implementation

Pure systems:

Designation Input (string) Output (string)
MOD 11-2 numeric 1 digit or X
MOD 37-2 alpha numeric 1 digit or letter or *
MOD 97-10 numeric 2 digits
MOD 661-26 alphabetic 2 letters
MOD 1271-36 alpha numeric 2 digits or letters

Hybrid systems:

Designation Input (string) Output (string)
MOD 11,10 numeric 1 digit
MOD 27,26 alphabetic 1 letter
MOD 37,36 alpha numeric 1 digit or letter

Credits

Some test cases were picked from:

License

MIT License

See LICENSE to see the full text.