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 +```