normalize_isbn_13: Attempt to enforce validity and canonical form to ISBN 13

View source: R/bibcodes.R

normalize_isbn_13R Documentation

Attempt to enforce validity and canonical form to ISBN 13

Description

Takes a string representation of an ISBN 13. Strips all non-digit 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 13 string.

Usage

normalize_isbn_13(x, aggressive = TRUE)

Arguments

x

A string

aggressive

A logical indicating whether aggressive measures should be taken to try to get the "ISBN 13" into a valid form. See "Details" for more info (default is TRUE)

Details

If aggressive is TRUE, aggressive measures are taken to try to salvage the malformed ISBN 13 string. If the ISBN 13, for example, is more than 13 characters, this function will attempt to make a valid ISBN 13 from the first 13 digits.

Value

Returns valid ISBN 13 if possible, NA if not

See Also

normalize_isbn normalize_isbn_10

Examples


normalize_isbn_13("978966819^*!X7918")        # "9789668197918"

# vectorized
normalize_isbn_13(c("978-9-66-819791-8", "__9__781572411579"))
# "9789668197918" "9781572411579"


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