normalize_isbn_10 {libbib} | R Documentation |
Attempt to enforce validity and canonical form to ISBN 10
Description
Takes a string representation of an ISBN 10. Strips all non-digit and non-"X" characters and checks if it is valid (whether the check digit works out, etc). User can specify whether "aggressive" measures should be taken to salvage the malformed ISBN 10 string.
Usage
normalize_isbn_10(x, aggressive = TRUE, convert.to.isbn.13 = FALSE)
Arguments
x |
A string |
aggressive |
A logical indicating whether aggressive measures
should be taken to try to get the "ISBN 10"
into a valid form. See "Details" for more info
(default is |
convert.to.isbn.13 |
A logical indicating whether the ISBN 10
should be converted into an ISBN 13
(default is |
Details
If aggressive
is TRUE, aggressive measures are taken to
try to salvage the malformed ISBN 10 string. If the ISBN 10, for example,
is 9 digits, and either adding an "X" to the end, or leading "0"s fix it,
this function will return the salvaged ISBN 10. If the ISBN 10 has
garbage digits/characters in the front and has an "X" check digit,
it will return the salvaged ISBN 10.
Value
Returns valid ISBN 10 if possible, NA if not
See Also
normalize_isbn
normalize_isbn_13
Examples
normalize_isbn_10("012491540x") # "012491540X"
normalize_isbn_10("012491540x xe32ea") # "012491540X"
normalize_isbn_10("012491540x", convert.to.isbn.13=TRUE)
# "9780124915404"
normalize_isbn_10("513213012491540x") # "012491540X"