docs: remove_last and replace_last

This commit is contained in:
James Prior
2022-12-02 23:48:50 +08:00
committed by Jun Yang
parent 6c3f1c1e0c
commit ff4fd44666
2 changed files with 34 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
---
title: remove_last
---
{% since %}v10.2.0{% endsince %}
Removes only the last occurrence of the specified substring from a string.
Input
```liquid
{{ "I strained to see the train through the rain" | remove_last: "rain" }}
```
Output
```text
I strained to see the train through the
```
+17
View File
@@ -0,0 +1,17 @@
---
title: replace_last
---
{% since %}v10.2.0{% endsince %}
Replaces only the last occurrence of the first argument in a string with the second argument.
Input
```liquid
{{ "Take my protein pills and put my helmet on" | replace_last: "my", "your" }}
```
Output
```text
Take my protein pills and put your helmet on
```