Purpose |
Parse a path/file name to extract component parts |
Syntax |
fil$
= PATHNAME$(director, filespec$) |
Remarks |
The PATHNAME$ function evaluates a text path/file
text name, and returns a requested part of the name. The
functionality is strictly one of
string parsing
alone. No
attempt is made to find the file on disk. If you wish to scan for a particular
file on disk, you should use the companion function PATHSCAN$. |
director |
This is one of the following words which is used to specify the requested
part:
FULL |
Returns the full path/file
name, just as given in the filespec$
parameter. This
is really a non-operation, but is included for symmetry with the companion
function PATHSCAN$. |
PATH |
Returns the path portion
of the path/file name. That
is the text up to and including the last backslash (\) or colon (:). |
NAME |
Return the name portion
of the path/file name. That
is the text to the
right of the last backslash (\) or colon (:), ending just before the last
period (.). |
EXTN |
Returns the extension portion
of the path/file name. That
is the last period
(.) in the string plus the text to the right of it. |
NAMEX |
Returns the NAME and the
EXTN parts combined. |
|
filespec$ |
A path/file name which does not necessarily exist on disk. |
See also |
DIR$, EXE,
PATHSCAN$, PARSE,
PARSE$, PARSECOUNT |
Example |
PATHNAME$(PATH, "C:\PB\XXX.TXT")
' returns "C:\PB\"
PATHNAME$(NAME, "C:\PB\XXX.TXT")
' returns "XXX"
PATHNAME$(NAMEX, "C:\PB\XXX.TXT") ' returns "XXX.TXT"
PATHNAME$(EXTN, "C:\PB\XXX.TXT")
' returns ".TXT" |