function [ i, j ] = filename_ext_get ( filename )

%*****************************************************************************80
%
%% filename_ext_get() determines the "extension" of a file name.
%
%  Discussion:
%
%    The "extension" of a filename is the string of characters
%    that appears after the LAST period in the name.  A file
%    with no period, or with a period as the last character
%    in the name, has a "null" extension.
%
%    Blanks are unusual in filenames.  This routine ignores all
%    trailing blanks, but will treat initial or internal blanks
%    as regular characters acceptable in a file name.
%
%    If no period occurs in FILENAME, then
%      I = J = -1;
%    Otherwise,
%      I is the position of the LAST period in FILENAME, and J is the
%      position of the last nonblank character following the period.
%
%  Example:
%
%    FILENAME   I  J
%
%    bob.for     4  7
%    N.B.C.D     6  7
%    Naomi.      6  6
%    Arthur     -1 -1
%    .com        1  1
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 November 2009
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string FILENAME, a file name to be examined.
%
%  Output:
%
%    integer I, J, the indices of the first and last characters
%    in the file extension.
%
  i = ch_index_last ( filename, '.' )

  if ( i == -1 )

    j = -1;

  else

    j = s_len_trim ( filename );

  end

  return
end
