Add remove_last, replace_last documentation (#1805)

This commit is contained in:
Eric Knibbe
2024-10-22 20:46:24 -04:00
committed by GitHub
parent 9abb5d1daf
commit 7429350ae2
2 changed files with 38 additions and 0 deletions
+19
View File
@@ -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
```
+19
View File
@@ -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
```