Skip to main content

$endsWith

The $endsWith operator checks if the first string ends with the second string.

Input

  • An array containing exactly two string values: the main string and the suffix to check

Output

  • true if the first string ends with the second string
  • false otherwise

Examples

Ends With

{
  "$endsWith": [
    "Hello, world!",
    "world!"
  ]
}
Result: true

Does Not End With

{
  "$endsWith": [
    "Hello, world!",
    "Hello"
  ]
}
Result: false

Field Value

{
  "$endsWith": [
    {
      "$input": "url"
    },
    ".pdf"
  ]
}
Result: true if the url field ends with “.pdf”, otherwise false