is_valid_isbn_13: Return TRUE if valid ISBN 13

View source: R/bibcodes.R

is_valid_isbn_13R Documentation

Return TRUE if valid ISBN 13

Description

Takes a string representation of an ISBN 13 verifies that it is valid. An ISBN 13 is valid if it is a 13 digit string and the check digit matches

Usage

is_valid_isbn_13(x, allow.hyphens = TRUE)

Arguments

x

A string of 13

allow.hyphens

A logical indicating whether the hyphen separator should be allowed (default is TRUE)

Value

Returns TRUE if checks pass, FALSE if not, and NA if NA

Examples


is_valid_isbn_13("9780306406157")          # TRUE
is_valid_isbn_13("978-0-306-40615-7")      # TRUE

# vectorized
is_valid_isbn_10(c("012491540X", "9004037812"))  # TRUE FALSE
is_valid_isbn_13(c("978-0-306-40615-7", "9783161484103"))  # TRUE FALSE
is_valid_isbn_13(c("978-0-306-40615-7", "hubo un tiempo"))  # TRUE FALSE


libbib documentation built on Nov. 10, 2022, 6:16 p.m.