https://github.com/ladutsko/isbn-core
ISBN core
https://github.com/ladutsko/isbn-core
isbn osgi
Last synced: 4 months ago
JSON representation
ISBN core
- Host: GitHub
- URL: https://github.com/ladutsko/isbn-core
- Owner: ladutsko
- License: mit
- Created: 2013-08-26T15:41:52.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-07-06T08:38:07.000Z (over 1 year ago)
- Last Synced: 2024-07-06T09:31:19.263Z (over 1 year ago)
- Topics: isbn, osgi
- Language: Java
- Size: 229 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java-zh - ISBN core - 一个小型库,其中包含ISBN-10和ISBN-13的表示对象以及用于解析,验证和格式化的工具。 (项目 / 杂项)
- fucking-awesome-java - ISBN core - A small library that contains a representation object of ISBN-10 and ISBN-13 and tools to parse, validate and format one. (Projects / Miscellaneous)
- awesome-java - ISBN core - A small library that contains a representation object of ISBN-10 and ISBN-13 and tools to parse, validate and format one. (Projects / Miscellaneous)
README
# ISBN core  [](https://maven-badges.herokuapp.com/maven-central/com.github.ladutsko/isbn-core) [](https://javadoc.io/doc/com.github.ladutsko/isbn-core)
`ISBN core` is a small library that contains a representation object of ISBN-10 and ISBN-13 and
tools to parse, validate and format one.
* Java 1.8+
* OSGi compatible
* GraalVM compatible
```xml
com.github.ladutsko
isbn-core
2.0.0
```
```groovy
implementation 'com.github.ladutsko:isbn-core:2.0.0'
```
## Quick start
```java
import com.github.ladutsko.isbn.ISBN;
import com.github.ladutsko.isbn.ISBNException;
import com.github.ladutsko.isbn.ISBNFormat;
class HelloWorld {
public static void main(String[] args) {
try {
ISBN isbn = ISBN.parseIsbn("0131872486"); // or 978-0131872486
// Valid isbn string
ISBNFormat format = new ISBNFormat();
System.out.println(format.format(isbn.getIsbn10())); // output: 0-13-187248-6
System.out.println(format.format(isbn.getIsbn13())); // output: 978-0-13-187248-6
} catch (ISBNException e) {
// Invalid isbn string
e.printStackTrace(); // Reason
}
}
}
```