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

filename_ext

(tmp_for_tar/misc/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: April 2001



Listing of function file tmp_for_tar/misc/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: April 2001

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 Apr 28 21:14:54 2001
Cross-Directory links are: ON