isbn v0.1.2 ISBN

Provides functions to work with ISBNs.

Summary

Functions

Converts ISBN 10 to ISBN 13

Checks if the given string is a valid ISBN

Checks if the string is a valid ISBN 10 number

Check if the string is a valid ISBN 13 number

Functions

convert_10_to_13(str)

Converts ISBN 10 to ISBN 13.

iex> ISBN.convert_10_to_13("161729201X")
"9781617292019"
valid?(s)

Checks if the given string is a valid ISBN.

Works with both ISBN-10 and ISBN-13. Allows hyphens in the string.

iex> ISBN.valid?("0-306-40615-2")
true

iex> ISBN.valid?("1234567")
false
valid_isbn10?(str)

Checks if the string is a valid ISBN 10 number.

iex> ISBN.valid_isbn10?("076243631-X")
true

iex> ISBN.valid_isbn10?("978-0-306-40615-7")
false

end

valid_isbn13?(str)

Check if the string is a valid ISBN 13 number

iex> ISBN.valid_isbn13?("9781617292019")
true

iex> ISBN.valid_isbn13?("076243631X")
false