Skip to content

unsuffix

Written as unsuffix(argnum flags):options in a transform expression.

Minimum arguments 1
Maximum arguments 2
Default arguments 1
Argument modes SINGLE_PRIMITIVE, MULTIPLE_PRIMITIVES

Remove a suffix from text (with flexible argument handling) if the suffix exists.

Works in 2 modes depending on number of arguments:

  • single arg mode: uses options string as the suffix
  • 2 arg mode: combines options string and the second argument (defaults to empty string, if null) as the suffix to remove
Flag Letter
spread_input s
noncaptive_input I
arg_num_flexible f
Input args: ["document.pdf"]
Transforms: "unsuffix:.pdf"
Output: "document"
Input args: ["data.json.gz",".gz"]
Transforms: "unsuffix:.json"
Output: "data"
Input args: ["archive.tar.gz"]
Transforms: "unsuffix:.gz"
Output: "archive.tar"