Articles in this section

chop helper

Removes leading and trailing whitespace and special characters from a string. It is useful when cleaning up input values before using them in a flow.

Usage

{{chop value}}
  • value (required): the input string

Examples

  1. Remove surrounding characters from labels

    {{chop record.label1}}
    {{chop record.label2}}
    {{chop record.label3}}
    

    Input:

    {
      "record": {
        "label1": "_ABC_",
        "label2": "-ABC-",
        "label3": " ABC "
      }
    }
    

    Output:

    ABC
    ABC
    ABC
    
  1. Preserve interior punctuation, strip only edges, and avoid HTML escaping with {{{...}}}

    {{{chop record.label}}}

    Input

     { "record": { "label": " Hello*&^World- " } }

    Output

     Hello*&^World

Tip

  • The helper removes spaces, underscores, dashes, and other non-alphanumeric characters at the start or end of the string.

  • It does not remove characters inside the string body. For example, "A_B_C" remains unchanged.

  • By default, Handlebars HTML-escapes the result. If you need raw output (for strings containing <, >, &, etc.), use {{{…}}}

  • Non-string inputs (datatypes such as number or boolean) are converted to strings before processing. Arrays of primitive types (like strings or numbers) are converted into a comma-separated string before processing. If inputs are objects or object arrays, the output will be unusable.