View Source Exisbn (Exisbn v0.1.2)
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 and returns its checkdigit.
Takes an ISBN and returns its prefix.
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
Takes an ISBN and returns its checkdigit.
examples
Examples
iex> Exisbn.fetch_checkdigit("9788535902778")
8
iex> Exisbn.fetch_checkdigit("2-1234-5680-2")
2
iex> Exisbn.fetch_checkdigit("str")
nil
Takes an ISBN and returns its prefix.
examples
Examples
iex> Exisbn.get_prefix("9788535902778")
"978-85"
iex> Exisbn.get_prefix("2-1234-5680-2")
"978-2"
iex> Exisbn.get_prefix("str")
nil
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 10 and converts it to ISBN 13.
examples
Examples
iex> Exisbn.isbn10_to_13("85-359-0277-5")
"9788535902778"
iex> Exisbn.valid?("9788535902778")
true
iex> Exisbn.isbn10_to_13("0306406152")
"9780306406157"
iex> Exisbn.valid?("9780306406157")
true
iex> Exisbn.isbn10_to_13("0-19-853453123")
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
Takes an ISBN 13 and converts it to ISBN 10.
examples
Examples
iex> Exisbn.isbn13_to_10("9788535902778")
"8535902775"
iex> Exisbn.valid?("8535902775")
true
iex> Exisbn.isbn13_to_10("9780306406157")
"0306406152"
iex> Exisbn.valid?("0306406152")
true
iex> Exisbn.isbn13_to_10("str")
nil
Takes an ISBN and returns its publisher zone.
examples
Examples
iex> Exisbn.publisher_zone("9788535902778")
"Brazil"
iex> Exisbn.publisher_zone("2-1234-5680-2")
"French language"
iex> Exisbn.publisher_zone("str")
nil
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-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