Split strings, replace characters, and combine strings
Split strings: Use .split()
{%- set mystring = "this_is_a_string" -%}
{{-
[
item for item in mystring.split("_")
]
-}}Replace characters: Use .replace() and | regex_replace()
{%- set mystring = "this_is_a_string" -%}
{{-mystring.replace("_", " ")-}}
{#- another way is like this -#}
{{- mystring | regex_replace("_", " ") -}}Combine strings: Use concatenation
Last updated
Was this helpful?

