View Source Exisbn (Exisbn v2.0.0)
Documentation for Exisbn
.
Link to this section Summary
Functions
Takes an ISBN (10 or 13) and checks its validity by its check digit
Checks if an ISBN (10 or 13) code is correctly hyphenated. If ISBN incorrect, that count as no.
Takes an ISBN and returns its checkdigit.
Takes an ISBN and returns its prefix.
Takes an ISBN and returns its publication element.
Takes an ISBN and returns its registrant element.
Takes an ISBN (10 or 13) and hyphenates it.
Takes an ISBN 10 code as string, returns its check digit.
Takes an ISBN 10 and converts it to ISBN 13.
Takes an ISBN 13 code as string, returns its check digit.
Takes an ISBN 13 and converts it to ISBN 10.
Takes an ISBN and returns its publisher zone.
Takes an ISBN (10 or 13) and checks its validity by checking the checkdigit, length and characters.
Link to this section Functions
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
Checks if an ISBN (10 or 13) code is correctly hyphenated. If ISBN incorrect, that count as no.
examples
Examples
iex> Exisbn.correct_hyphens?("978-85-359-0277-8")
true
iex> Exisbn.correct_hyphens?("97-8853590277-8")
false
iex> Exisbn.correct_hyphens?("0-306-40615-2")
true
iex> Exisbn.correct_hyphens?("03-064-06152")
false
iex> Exisbn.correct_hyphens?("str")
false
Takes an ISBN and returns its checkdigit.
examples
Examples
iex> Exisbn.fetch_checkdigit("9788535902778")
{:ok, "8"}
iex> Exisbn.fetch_checkdigit("2-1234-5680-2")
{:ok, "2"}
iex> Exisbn.fetch_checkdigit("str")
{:error, :invalid_isbn}
iex> Exisbn.fetch_checkdigit("887385107X")
{:ok, "X"}
Takes an ISBN and returns its prefix.
examples
Examples
iex> Exisbn.fetch_prefix("9788535902778")
{:ok, "978-85"}
iex> Exisbn.fetch_prefix("2-1234-5680-2")
{:ok, "978-2"}
iex> Exisbn.fetch_prefix("str")
{:error, :invalid_isbn}
Takes an ISBN and returns its publication element.
examples
Examples
iex> Exisbn.fetch_publication_element("978-1-86197-876-9")
{:ok, "876"}
iex> Exisbn.fetch_publication_element("9789529351787")
{:ok, "5178"}
iex> Exisbn.fetch_publication_element("str")
{:error, :invalid_isbn}
Takes an ISBN and returns its registrant element.
examples
Examples
iex> Exisbn.fetch_registrant_element("9788535902778")
{:ok, "359"}
iex> Exisbn.fetch_registrant_element("978-1-86197-876-9")
{:ok, "86197"}
iex> Exisbn.fetch_registrant_element("9789529351787")
{:ok, "93"}
iex> Exisbn.fetch_registrant_element("str")
{:error, :invalid_isbn}
Takes an ISBN (10 or 13) and hyphenates it.
examples
Examples
iex> Exisbn.hyphenate("9788535902778")
{:ok, "978-85-359-0277-8"}
iex> Exisbn.hyphenate("0306406152")
{:ok, "0-306-40615-2"}
iex> Exisbn.hyphenate("str")
{:error, :invalid_isbn}
Takes an ISBN 10 code as string, returns its check digit.
examples
Examples
iex> Exisbn.isbn10_checkdigit("85-359-0277")
{:ok, "5"}
iex> Exisbn.isbn10_checkdigit("5-02-013850")
{:ok, "9"}
iex> Exisbn.isbn10_checkdigit("0str")
{:error, :invalid_isbn}
iex> Exisbn.isbn10_checkdigit("887385107")
{:ok, "X"}
Takes an ISBN 10 and converts it to ISBN 13.
examples
Examples
iex> Exisbn.isbn10_to_13("85-359-0277-5")
{:ok, "9788535902778"}
iex> Exisbn.valid?("9788535902778")
true
iex> Exisbn.isbn10_to_13("0306406152")
{:ok, "9780306406157"}
iex> Exisbn.valid?("9780306406157")
true
iex> Exisbn.isbn10_to_13("0-19-853453123")
{:error, :invalid_isbn}
Takes an ISBN 13 code as string, returns its check digit.
examples
Examples
iex> Exisbn.isbn13_checkdigit("978-5-12345-678")
{:ok, "1"}
iex> Exisbn.isbn13_checkdigit("978-0-306-40615")
{:ok, "7"}
iex> Exisbn.isbn13_checkdigit("0str")
{:error, :invalid_isbn}
Takes an ISBN 13 and converts it to ISBN 10.
examples
Examples
iex> Exisbn.isbn13_to_10("9788535902778")
{:ok, "8535902775"}
iex> Exisbn.valid?("8535902775")
true
iex> Exisbn.isbn13_to_10("9780306406157")
{:ok, "0306406152"}
iex> Exisbn.valid?("0306406152")
true
iex> Exisbn.isbn13_to_10("str")
{:error, :invalid_isbn}
Takes an ISBN and returns its publisher zone.
examples
Examples
iex> Exisbn.publisher_zone("9788535902778")
{:ok, "Brazil"}
iex> Exisbn.publisher_zone("2-1234-5680-2")
{:ok, "French language"}
iex> Exisbn.publisher_zone("str")
{:error, :invalid_isbn}
Takes an 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")
false
iex> Exisbn.valid?("85-359-0277-5")
true
iex> Exisbn.valid?("85-359-0277")
false