function value = isbn_is_valid ( s )

%*****************************************************************************80
%
%% isbn_is_valid() reports whether an ISBN is valid.
%
%  Discussion:
%
%    ISBN stands for International Standard Book Number.  A unique ISBN
%    is assigned to each new book.  The ISBN includes 10 digits.  There is
%    an initial digit, then a dash, then a set of digits which are a
%    code for the publisher, another digit, and then the check digit:
%
%      initial-publisher-book-check
%
%    The number of digits used for the publisher and book codes can vary,
%    but the check digit is always one digit, and the total number of
%    digits is always 10.
%
%    The check digit is interesting, because it is a way of trying to
%    make sure that an ISBN has not been incorrectly copied.  Specifically,
%    if the ISBN is correct, then its ten digits will satisfy
%
%       10 * A + 9 * B + 8 * C + 7 * D + 6 * E
%      + 5 * F * 4 * G * 3 * H + 2 * I +     J  = 0 mod 11.
%
%    Here, we've taken 'A' to represent the first digit and 'J' the
%    last (which is the check digit).  In order for the code to work,
%    the value of J must be allowed to be anything from 0 to 10.  In
%    cases where J works out to be 10, the special digit 'X' is used.
%    An 'X' digit can only occur in this last check-digit position
%    on an ISBN.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    16 September 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string S, a string containing 12 digits.
%    Dashes and other characters will be ignored.
%
%  Output:
%
%    logical VALUE: true if the string is valid.
%
  n = 10;
  dvec = s_to_isbn_digits ( s, n );

  c1 = isbn_check_digit_calculate ( s );
  d1 = isbn_digit_to_i4 ( c1 );

  d2 = dvec(10);

  if ( d1 == d2 )
    value = 1;
  else
    value = 0;
  end

  return
end
