Skip to content

Instantly share code, notes, and snippets.

@jkoop
Created March 27, 2023 21:33
Show Gist options
  • Save jkoop/cd620edc34cc43c37c07669c85a38966 to your computer and use it in GitHub Desktop.
Save jkoop/cd620edc34cc43c37c07669c85a38966 to your computer and use it in GitHub Desktop.
13 digit ISBN checker for SQLite3
(10 - (
substr(isbn, 1, 1) * 1 +
substr(isbn, 2, 1) * 3 +
substr(isbn, 3, 1) * 1 +
substr(isbn, 4, 1) * 3 +
substr(isbn, 5, 1) * 1 +
substr(isbn, 6, 1) * 3 +
substr(isbn, 7, 1) * 1 +
substr(isbn, 8, 1) * 3 +
substr(isbn, 9, 1) * 1 +
substr(isbn, 10, 1) * 3 +
substr(isbn, 11, 1) * 1 +
substr(isbn, 12, 1) * 3
) % 10) % 10 = substr(isbn, 13, 1) + 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment