小编Lir*_* Su的帖子

如何检查字符串是否以 Liquid 中的特定子字符串结尾?

我知道有一个contains关键字,所以我可以使用:

{% if some_string contains sub_string %}
    <!-- do_something -->
{% ... %}
Run Code Online (Sandbox Code Playgroud)

但是如何检查字符串是否以特定子字符串结尾?

我试过这个,但它不起作用:

{% if some_string.endswith? sub_string %}
    <!-- do_something -->
{% ... %}
Run Code Online (Sandbox Code Playgroud)

ruby liquid jekyll

5
推荐指数
2
解决办法
3643
查看次数

标签 统计

jekyll ×1

liquid ×1

ruby ×1