Skip to content

Bars Specification 0.1.0 — Transform: replace

Category: string · Since: 0.1.0

Replaces every occurrence of a substring.

Replaces every occurrence of old with new in the string-coerced input.

Input coercion: string

Arguments

Name Type Optional Default
old string no
new string no

Arity: 2–2

Worked examples

{{ phrase | replace: "world" "Mark" }}

hello Mark, big Mark
{{ phrase | upcase | replace: "WORLD" "Mark" }}

HELLO Mark

Full fixture: transforms/transform-replace.json