Delegate functions to corresponding replace functions

This commit is contained in:
Anders Søgaard
2021-09-10 08:24:50 +02:00
parent d5ecf00a8c
commit f72cfb13ab
+3 -3
View File
@@ -303,17 +303,17 @@ module Liquid
# remove a substring
def remove(input, string)
input.to_s.gsub(string.to_s, '')
replace(input.to_s, string, '')
end
# remove the first occurrences of a substring
def remove_first(input, string)
input.to_s.sub(string.to_s, '')
replace_first(input.to_s, string, '')
end
# remove the last occurences of a substring
def remove_last(input, string)
input.to_s.reverse.sub(string.to_s.reverse, '').reverse
replace_last(input.to_s, string, '')
end
# add one string to another