slice

slice

Returns a substring of 1 character beginning at the index specified by the argument passed in. An optional second argument specifies the length of the substring to be returned.

String indices are numbered starting from 0.

Input

{{ "Liquid" | slice: 0 }}

Output

L

Input

{{ "Liquid" | slice: 2 }}

Output

q

Input

{{ "Liquid" | slice: 2, 5 }}

Output

quid

If the first parameter is a negative number, the indices are counted from the end of the string:

Input

{{ "Liquid" | slice: -3, 2 }}

Output

ui

© 2005, 2006 Tobias Luetke
Licensed under the MIT License.
https://shopify.github.io/liquid/filters/slice/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部