function value = lennob ( s )

%*****************************************************************************80
%
%% LENNOB counts the length of a string, ignoring trailing blanks.
%
%  Discussion:
%
%    This procedure returns the length of a string up to and including
%    the last non-blank character.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    31 March 2013
%
%  Author:
%
%    Original FORTRAN77 version by Barry Brown, James Lovato.
%    MATLAB version by John Burkardt.
%
%  Parameters:
%
%    Input, string S, the string.
%
%    Output, integer VALUE, the length of the string to the last
%    nonblank.
%
  s_max = length ( s );

  for i = s_max : -1 : 1
    if ( s(i:i) ~= ' ' );
      value = i;
      return
    end
  end

  value = 0;

  return
end
