is_valid_isbn_10 {libbib} | R Documentation |
Return TRUE if valid ISBN 10
Description
Takes a string representation of an ISBN 10 verifies that it is valid. An ISBN 10 is valid if it is a 10 digit string or a 9 digit string with a terminal "X" AND the check digit matches
Usage
is_valid_isbn_10(x, allow.hyphens = TRUE, lower.x.allowed = TRUE)
Arguments
x |
A string of 10 digits or 9 digits with terminal "X" |
allow.hyphens |
A logical indicating whether the hyphen
separator should be allowed
(default is |
lower.x.allowed |
A logical indicating whether ISBN 10s with
a check digit with a lower-case "x" should
be treated as valid
(default is |
Value
Returns TRUE if checks pass, FALSE if not, and NA if NA
Examples
is_valid_isbn_10("012491540X") # TRUE
is_valid_isbn_10("0-124-91540-X") # TRUE
# vectorized
is_valid_isbn_10(c("012491540X", "9004037812")) # TRUE FALSE
is_valid_isbn_10(c("012491540X", "hubo un tiempo")) # TRUE FALSE
[Package libbib version 1.6.4 Index]