[Index for tmp_for_tar/imgio] [Return to Master Index]

filename_ext

(tmp_for_tar/imgio/filename_ext.m)


Function Synopsis

ext = filename_ext( fname )

Help text

       ext = filename_ext( fname )

  Returns the extension -- whatever is after the last dot (".") in fname,
                           IF there is no slash after that dot.

  Returns "" if fname contains no dot or if the last dot is clearly in a
  directory name, as in "A.B/foo".

  Derived from Andy Adler's imread.m.

 Last modified: Setembro 2002



Listing of function file tmp_for_tar/imgio/filename_ext.m

##       ext = filename_ext( fname )
##
##  Returns the extension -- whatever is after the last dot (".") in fname,
##                           IF there is no slash after that dot.
##
##  Returns "" if fname contains no dot or if the last dot is clearly in a
##  directory name, as in "A.B/foo".
##
##  Derived from Andy Adler's imread.m.
##

## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
## Last modified: Setembro 2002

function ext = filename_ext( fname )
  
  ext = "" ;

  if nargin < 1, return ; end

  dot = max (find (fname==".")); 
  if ! isempty(dot) && isempty (find (fname(dot+1:length(fname))=="/")), 
    ext = fname(dot+1:length(fname));
  end


Produced by oct2html on Sat Sep 14 9:47:03 2002
Cross-Directory links are: ON