Files
liquid/filters/replace_first.md
2016-11-08 16:23:33 -05:00

569 B

title, description
title description
replace_first Liquid filter that replaces the first occurrence of a given substring in a string.

Replaces only the first occurrence of the first argument in a string with the second argument.

Input

```liquid {% raw %} {% assign my_string = "Take my protein pills and put my helmet on" %} {{ my_string | replace_first: "my", "your" }} {% endraw %} ```

Output

```text {% assign my_string = "Take my protein pills and put my helmet on" %} {{ my_string | replace_first: "my", "your" }} ```