Did you know ... Search Documentation:
Pack pro2sql -- prolog/file_path_name_ext.pro
PublicShow source
 file_path_name_ext(+File:atom, -Path:atom, -Name:atom, -Extension:atom) is semidet
file_path_name_ext(-File:atom, ?Path:atom, +Name:atom, +Extension:atom) is multi
 file_path_name_ext(+File:atom, +DExt:atom, -Path:atom, -Name:atom, ?Extension:atom) is semidet
file_path_name_ext(-File:atom, -DExt:atom, ?Path:atom, +Name:atom, +Extension:atom) is multi
Separate a (full) URL into Path, Name and Extension, or construct the absolute file name from Path (optional), Name and Extension (or DExt).

Note: In alignment with URI formats, filenames may end with #, typically in cases where the filename is used as a prefix for entities. In this case, the # is stripped from the name and ignored.

Arguments:
File- If input, then an "expandable" file path and name. Extension is optional, if a default extension DExt is given. Input may optionally have a scheme prefix of `file://`. Input may also have an ending URI entity suffix (#) which will be stripped. If output, then the absolute file path and name.
Path- If input, then an "expandable" path. Trailing slashes are optional for resulting absolute file names. If output, then absolute path, including trailing slash.
Name- Filename without extension
DExt- Default filename extension (e.g. txt) without the dot prefix
Extension- Filename extension (e.g. txt) without the dot prefix

Example use:

:- file_path_name_ext('~/.config/swi-prolog/init.pl',P,N,E).
P = '/home/myusername/.config/swi-prolog/''
N = init
E = pl

:- file_path_name_ext(F,library(pldoc),doc_process,pl).
F = '/home/myusername/.config/swi-prolog/library/pldoc/doc_process.pl';
F = '/usr/lib/swi-prolog/library/pldoc/doc_process.pl';
...etc.

 lastchar(+Text:atomic, ?Char:char) is semidet
Get or check the last character of a string or atom
Arguments:
Text- string or atom
Char- the last character of Text

Example use:

:- lastchar('Hello World!',C).
C = '!'

 firstchar(+Text:atomic, ?Char:char) is semidet
Get or check the first character of a string or atom
Arguments:
String- string or atom
Char- the first character of Text

Example use:

:- fistchar('Hello World!',C).
C = 'H'

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 file_path_name_ext(Arg1, Arg2, Arg3, Arg4, Arg5)