function value = isbn13_is_valid ( s )

%*****************************************************************************80
%
%% isbn13_is_valid() reports whether an ISBN13 is valid.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    30 May 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string S, a string containing 13 digits.
%    Dashes and other characters will be ignored.
%
%  Output:
%
%    logical VALUE: true if the string is a valid ISBN13 code.
%

%
%  Compute the ISBN13 check digit and convert it to a digit.
%
  c1 = isbn13_check_digit ( s );
  d1 = c1 - '0';
%
%  Retrieve the first 13 digits in the string.
%
  n = 13;
  dvec = s_to_digits ( s, n );
%
%  Compare the check digit to the 13th digit in string.
%
  d2 = dvec(n);

  value = ( d1 == d2 );

  return
end
