Skip to content

endsWith

endsWith(string, suffix) → boolean · String

Check if a string ends with a given substring.

  • string (required): the string to test

  • suffix (required): the substring to check for

bash
echo '{"filename": "invoice-2026.xml"}' | utlx -e 'endsWith($input.filename, ".xml")'
# true
utlx
{
  isXml: endsWith($input.filename, ".xml"),
  isJson: endsWith($input.filename, ".json"),
  utlxFiles: filter($input.files, (f) -> endsWith(f.name, ".utlx"))
}

Released under AGPL-3.0.