Answers.Body: <p>Twig has a <a href="http://twig.sensiolabs.org/doc/filters/replace.html">replace filter</a> for that. You can replace strings/vars with strings/vars: </p>
  
  <pre><code>{% set string = "I love apples" %}
  {% set var = "like" %}
  {% set string = string|replace({'apples': 'kiwis', 'love': var}) %}
  
  {{ string }} {# Prints "I like kiwis" #}
  </code></pre>
  
  <p>Your example:</p>
  
  <pre><code>{% set rgb = "Red; Green; Blue" %}
  {% set rgb = rgb|replace({';': ','}) %}
  
  {{ rgb }} {# Prints "Red, Green, Blue" #}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-16T20:49:09.087Z
Answers.Text: Thanks for this! Helped me out with replacing something with a variable.
Answers.UserDisplayName: mateostabio
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-14T13:35:37.953Z
Answers.Text: Worth noting that Craft actually comes with its own version of the replace filter, which actually supports a simpler syntax if you’re only replacing one thing: `|replace('apples', 'kiwis')`
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-14T11:19:30.177Z
Answers.LastActivityDate: 2014-06-14T11:19:30.177Z
Answers.UserDisplayName: Victor
Body: <p>How do I replace ";" with "," in string "Red; Green; Blue"?</p>
  
  <pre><code>{% set rgb = "Red; Green; Blue" %}
  </code></pre>
  
Tags: <string><replace>
Title: How to replace characters in string
ThreadText: # How to replace characters in string
  
  (Asked by: username_0 on 2014-06-14)
  
  How do I replace ";" with "," in string "Red; Green; Blue"?
  
  ```
  {% set rgb = "Red; Green; Blue" %}
  
  ```
  
  **Tags:** string, replace
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-06-14. Score: 21 | Accepted answer
  
  Twig has a [replace filter](http://twig.sensiolabs.org/doc/filters/replace.html) for that. You can replace strings/vars with strings/vars:
  
  ```
  {% set string = "I love apples" %}
  {% set var = "like" %}
  {% set string = string|replace({'apples': 'kiwis', 'love': var}) %}
  
  {{ string }} {# Prints "I like kiwis" #}
  
  ```
  
  Your example:
  
  ```
  {% set rgb = "Red; Green; Blue" %}
  {% set rgb = rgb|replace({';': ','}) %}
  
  {{ rgb }} {# Prints "Red, Green, Blue" #}
  
  ```
  
  > **Comments:**
  > **username_3**: Worth noting that Craft actually comes with its own version of the replace filter, which actually supports a simpler syntax if you’re only replacing one thing: `|replace('apples', 'kiwis')`  
  > **username_2**: Thanks for this! Helped me out with replacing something with a variable.  
  
  ---
  
  