Skip to content

Conformance Examples 0.1.0 — Transforms: transform-remove

remove-all-occurrences

Removes every occurrence of the argument substring.

Template

{{ phrase | remove: "o" }}

Context

{
    "phrase": "foo boo"
}

Output

f b

remove-target-absent

If the substring is absent, output equals input.

Template

{{ phrase | remove: "xyz" }}

Context

{
    "phrase": "hello world"
}

Output

hello world

remove-empty-arg

Removing an empty string leaves the input unchanged.

Template

{{ phrase | remove: "" }}

Context

{
    "phrase": "hello"
}

Output

hello

remove-chained-after-upcase

Composes correctly when input arrives from a prior transform.

Template

{{ phrase | upcase | remove: "L" }}

Context

{
    "phrase": "hello"
}

Output

HEO

Source fixture: transforms/transform-remove.json