function value = isbn_digit_to_i4 ( c )

%*****************************************************************************80
%
%% isbn_digit_to_i4() converts an ISBN digit into an integer.
%
%  Discussion:
%
%    The characters '0' through '9' stand for themselves, but
%    the character 'X' or 'x' stands for 10.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    character C, the ISBN character code to be converted.
%
%  Output:
%
%    integer VALUE, the numeric value of the character
%    code, between 0 and 10.  This value is returned as -1 if C is
%    not a valid character code.
%
       if ( c == '0' )
    value = 0;
  elseif ( c == '1' )
    value = 1;
  elseif ( c == '2' )
    value = 2;
  elseif ( c == '3' )
    value = 3;
  elseif ( c == '4' )
    value = 4;
  elseif ( c == '5' )
    value = 5;
  elseif ( c == '6' )
    value = 6;
  elseif ( c == '7' )
    value = 7;
  elseif ( c == '8' )
    value = 8;
  elseif ( c == '9' )
    value = 9;
  elseif ( c == 'X' || c == 'x' )
    value = 10;
  else
    value = -1;
  end

  return
end
