remove_first 从一个字符串中仅仅删除第一次出现的另一个子字符串。 输入 {{ "I strained to see the train through the rain" | remove_first: "rain" }} 输出 I sted to see the train through the rain
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
slice 只传入一个参数时将返回此参数作为下标所对应的单个字符。第二个参数是可选的,用于指定返回的子字符串的长度。 String indices are numbered starting from 0. 输入 {{ "Liquid" | slice: 0 }} 输出 L 输入 {{ "Liquid" | slice: 2 }} 输出 q 输入 {{ "Liquid" | slice: 2, 5 }} 输出 quid If the first parameter is ...