string.popSuffix

Syntax string.popSuffix (string, separator)

Params string is a string which you want to remove any suffixes from.

separator is an optional character that separates a name from a suffix

Action Returns the part of the string up to, but not including, the last occurrence of separator.

Returns The resulting string.

Examples string.popSuffix ("file.html", '.')

   » "file"

string.popSuffix ("file.html")

   » "file" // If the separator is not given, it is assumed to be '.'.

string.popSuffix ("file.html.hqx")

   » "file.html" // It only removes the last suffix.

Discuss