mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-04 01:25:14 -07:00
Add remove_last, replace_last documentation (#1805)
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
title: remove_last
|
||||||
|
description: Liquid filter that removes the last occurence of a given substring from a string.
|
||||||
|
version-badge: 5.2.0
|
||||||
|
---
|
||||||
|
|
||||||
|
Removes only the last occurrence of the specified substring from a string.
|
||||||
|
|
||||||
|
<p class="code-label">Input</p>
|
||||||
|
```liquid
|
||||||
|
{%- raw -%}
|
||||||
|
{{ "I strained to see the train through the rain" | remove_last: "rain" }}
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p class="code-label">Output</p>
|
||||||
|
```text
|
||||||
|
I strained to see the train through the
|
||||||
|
```
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
title: replace_last
|
||||||
|
description: Liquid filter that replaces the last occurrence of a given substring in a string.
|
||||||
|
version-badge: 5.2.0
|
||||||
|
---
|
||||||
|
|
||||||
|
Replaces only the last occurrence of the first argument in a string with the second argument.
|
||||||
|
|
||||||
|
<p class="code-label">Input</p>
|
||||||
|
```liquid
|
||||||
|
{%- raw -%}
|
||||||
|
{{ "Take my protein pills and put my helmet on" | replace_last: "my", "your" }}
|
||||||
|
{% endraw %}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p class="code-label">Output</p>
|
||||||
|
```text
|
||||||
|
Take my protein pills and put your helmet on
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user