Go library for parsing, validating, and converting ISBN numbers.
- Bidirectional conversion
ISBN-10→ISBN-13ISBN-13→ISBN-10(only for the978prefix)
- Normalization
- Strips hyphens and
ISBNprefix case‑insensitively - Accepts lowercase
xor uppercaseXin ISBN-10 check digit
- Strips hyphens and
- Validation
- Verifies checksums for both ISBN-10 and ISBN-13
- Convenience
String()method for pretty-printing
go get github.com/GianniBYoung/simpleISBN- Import it:
import "github.com/GianniBYoung/simpleISBN"- Create an Instance
isbn, _ := simpleISBN.NewISBN("153432593X")
fmt.Println(isbn.ISBN13Number)
fmt.Println(isbn)- Or Just Convert an ISBN
testISBN10 := "153432593X"
testISBN13 := "9781534325937"
// 10 -> 13
isbn_13, _ := simpleISBN.ConvertISBN(testISBN10, simpleISBN.ISBN13)
// 13 -> 10
isbn_10, _ := simpleISBN.ConvertISBN(testISBN13, simpleISBN.ISBN10)
fmt.Println("Here is the ISBN-13: " + isbn_13)
fmt.Println("Here is the ISBN-10: " + isbn_10)