[Index for tmp_for_tar/misc]
[Return to Master Index]
filename_noext
(tmp_for_tar/misc/filename_noext.m)
Function Synopsis
f = filename_noext( fname )
Help text
f = filename_noext( fname )
Returns fname without extension -- whatever is before the last dot (".")
in fname, IF there is no slash after that dot.
Returns fname 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_noext.m
## f = filename_noext( fname )
##
## Returns fname without extension -- whatever is before the last dot (".")
## in fname, IF there is no slash after that dot.
##
## Returns fname 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 f = filename_noext( fname )
f = fname ;
if nargin < 1, return ; end
dot = max (find (fname=="."));
if ! isempty (dot) && isempty (find (fname(dot+1:length(fname))=="/")),
f = fname(1:dot-1);
elseif isempty (dot),
f = fname
end
Produced by oct2html on Sat Apr 28 21:14:54 2001
Cross-Directory links are: ON