function [ ch, s ] = ch_extract ( s )

%*****************************************************************************80
%
%% ch_extract() extracts the next nonblank character from a string.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 April 2006
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string S, the string. 
%
%  Output:
%
%    character CH, the leading character of the string.
%
%    string S, the input string, after the first 
%    nonblank character has been removed, and the string 
%    shifted left.
%
  s_len = s_len_trim ( s );
  ch = ' ';

  get = 1;

  while ( get <= s_len )

    if ( s(get) ~= ' ' )
      ch = s(get);
      if ( get < s_len )
        s = s(get+1:);
      else
        s = [];
      end
      break
    end

    get = get + 1;

  end

  return
end
