Functions | |
if (isempty(ds)) ds=0 | |
if (es<=ds) es | |
endif | if (ds==0) directory |
elseif (ds==1) directory | |
if (es > 0 &&es<=length(filename)) extension | |
else | error ("fileparts: expecting filename argument to be a string") |
endif else | print_usage () |
!assert (strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,"")) | |
!assert (strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,"/")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,"dir")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,".")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,"d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,"/d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext")) | |
!assert (strcmp(d,"/")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext")) | |
!assert (strcmp(d,"")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext")) | |
Variables | |
function [directory, name, extension, version] | |
endif | es = rindex (filename, ".") |
else | directory = filename(1:ds-1) |
endif | name = filename(ds+1:es-1) |
else | extension = "" |
endif | version = "" |
endif endfunction | !test [d, n, e] = fileparts ("file") |
!assert | ( | strcmp(d,"")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"/")&&strcmp(n, char(zeros(1, 0)))&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"/d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"d1/d2")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,".")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"dir")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"/")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,".ext") | ) |
!assert | ( | strcmp(d,"")&&strcmp(n,"file")&&strcmp(e,"") | ) |
elseif | ( | ds | = =1 |
) |
endif if | ( | ds | = =0 |
) |
if | ( | es<= | ds | ) |
if | ( | isempty(ds) | ) | [pure virtual] |
!test[d, n, e] = fileparts ("file") |
endif version = "" |