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 ...