[ Obsolete | Reference Manual | Alphabetic Index ]

suffix(+FileName, -Suffix)

Succeeds if the string Suffix is the extension part of the input string FileName.
FileName
String or atom.
Suffix
String or variable.

This built-in predicate is obsolete!

Description

Used to find the extension (i.e. suffix) Suffix of the input string file name FileName. FileName is a string of a (relative or absolute) file pathname. Suffix includes the leading ``.''.

Modes and Determinism

Exceptions

(4) instantiation fault
FileName is not instantiated.
(5) type error
FileName is not a string or atom.
(5) type error
Suffix is neither a string nor a variable.

Examples

Success:
      suffix("a.b",".b").
      suffix("dead.letter",".letter").
      suffix("top.pl",S).                (gives S=".pl").
      suffix("bugs",S).                  (gives S="").
      suffix("../my.pl",S).              (gives S=".pl").
      suffix("../user/my.c",S).          (gives S=".c").
      suffix("/home/user/pl/.trace",S).  (gives S=".trace").

Fail:
      suffix("file.pl",".c").

Error:
      suffix(F,S).                      (Error 4).
      suffix('file1.pl',S).             (Error 5).
      suffix("file1.pl",'.pl').         (Error 5).



See Also

pathname / 4, pathname / 2