From ff4fd44666d512789dec4e878dd75786e788041f Mon Sep 17 00:00:00 2001 From: James Prior Date: Fri, 2 Dec 2022 11:15:32 +0000 Subject: [PATCH] docs: remove_last and replace_last --- docs/source/filters/remove_last.md | 17 +++++++++++++++++ docs/source/filters/replace_last.md | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 docs/source/filters/remove_last.md create mode 100644 docs/source/filters/replace_last.md diff --git a/docs/source/filters/remove_last.md b/docs/source/filters/remove_last.md new file mode 100644 index 000000000..adb8ed3dd --- /dev/null +++ b/docs/source/filters/remove_last.md @@ -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 +``` diff --git a/docs/source/filters/replace_last.md b/docs/source/filters/replace_last.md new file mode 100644 index 000000000..4da4a7c5a --- /dev/null +++ b/docs/source/filters/replace_last.md @@ -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 +```