replace(替换参数)


将参数中给出的第一个参数全部替换为第二个参数。

输入
{{ "Take my protein pills and put my helmet on" | replace: "my", "your" }}
输出
Take your protein pills and put your helmet on

replace_first

将字符串中出现的第一个参数替换为第二个参数。
输入
{% assign my_string = "Take my protein pills and put my helmet on" %} {{ my_string | replace_first: "my", "your" }}
输出
Take your protein pills and put my helmet on
song song
4 个月前
0

扫描下方二维码手机阅读文章

0 0