Library
Module
Module type
Parameter
Class
Class type
Module encapsulating ISBNs. It takes advantage of the check digit to make sure that any given ISBN is correct. It supports both 10 and 13-digit ISBNs.
val of_string : string -> t
Converts a string into an ISBN, represented by type t
. Raises an exception if the string cannot be converted into a valid ISBN. Both 10 and 13-digit ISBNs are accepted. Moreover, the string may contain dashes, which are automatically removed if present.
val to_string : t -> string
Returns a string representation of the ISBN. The same type of ISBN (10 or 13-digit) originally used to construct the value is returned, but without any dashes.
val to_string10 : t -> string option
Returns a string with the 10-digit ISBN representation of t
. Since it is not always possible to construct a 10-digit ISBN from a 13-digit one, the function may return None
.
val to_string13 : t -> string
Returns a string with the 13-digit ISBN representation of t
. Note that it is always possible to build a 13-digit ISBN.
Does the given string represent a valid ISBN number? Both 10 and 13-digit ISBNs are accepted. Moreover, the string may contain dashes, which are automatically removed if present.
Does the given string represent a valid 10-digit ISBN number? The string may contain dashes, which are automatically removed if present.