View Source Exisbn (Exisbn v0.1.0)

Documentation for Exisbn.

Link to this section Summary

Functions

Takes an ISBN (10 or 13) and checks its validity by its check digit

Takes an ISBN 10 code as string, returns its check digit.

Takes an ISBN 13 code as string, returns its check digit.

Takes and ISBN (10 or 13) and checks its validity by checking the checkdigit, length and characters.

Link to this section Functions

Link to this function

checkdigit_correct?(isbn)

View Source

Takes an ISBN (10 or 13) and checks its validity by its check digit

examples

Examples

iex> Exisbn.checkdigit_correct?("85-359-0277-5") true iex> Exisbn.checkdigit_correct?("978-5-12345-678-1") true iex> Exisbn.checkdigit_correct?("978-5-12345-678") false

Takes an ISBN 10 code as string, returns its check digit.

examples

Examples

iex> Exisbn.isbn10_checkdigit("85-359-0277") 5 iex> Exisbn.isbn10_checkdigit("5-02-013850") 9 iex> Exisbn.isbn10_checkdigit("0str") nil

Takes an ISBN 13 code as string, returns its check digit.

examples

Examples

iex> Exisbn.isbn13_checkdigit("978-5-12345-678") 1 iex> Exisbn.isbn13_checkdigit("978-0-306-40615") 7 iex> Exisbn.isbn13_checkdigit("0str") nil

@spec valid?(String.t()) :: boolean()

Takes and ISBN (10 or 13) and checks its validity by checking the checkdigit, length and characters.

examples

Examples

iex> Exisbn.valid?("978-5-12345-678-1") true iex> Exisbn.valid?("978-5-12345-678-1") true iex> Exisbn.valid?("978-5-12345-678") false iex> Exisbn.valid?("85-359-0277-5") true iex> Exisbn.valid?("85-359-0277") false