Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nasa9084/go-isbn
https://github.com/nasa9084/go-isbn
go golang isbn
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nasa9084/go-isbn
- Owner: nasa9084
- License: mit
- Created: 2019-01-26T06:42:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-28T04:43:32.000Z (almost 6 years ago)
- Last Synced: 2024-10-05T00:40:53.270Z (about 1 month ago)
- Topics: go, golang, isbn
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-isbn
===
[![Build Status](https://travis-ci.org/nasa9084/go-isbn.svg?branch=master)](https://travis-ci.org/nasa9084/go-isbn)
[![GoDoc](https://godoc.org/github.com/nasa9084/go-isbn?status.svg)](https://godoc.org/github.com/nasa9084/go-isbn)a package for parsing/validating ISBN(International Standard Book Number).
## SYNOPSIS
``` go
import (
"log""github.com/nasa9084/go-isbn"
)
var n = "ISBN978-4-00-310101-8"func main() {
// parse
code, err := isbn.Parse(n)
if err != nil {
log.Fatal(err)
}
// validate
if !code.IsValid() {
log.Print("given ISBN code is invalid")
}
// update legacy 10-length code to 13-length code
if code.IsLegacy {
code, err = code.Update()
if err != nil {
log.Fatal(err)
}
}
// format
fmt.Printf("%s", code.String())
}
```