How to get a specific digit in a number in the Anqi CMS template?
get_digit
How to use
get_digit
How to use filters:
{{ obj|get_digit:number }}
For example, you need to obtain1234567890
To get the third last digit, you can write it like this:
{{ 1234567890|get_digit:3 }}
# 显示结果
8
Sample Demo
{{ 1234567890|get_digit:0 }}
{{ 1234567890|get_digit }}
{{ 1234567890|get_digit:2 }}
{{ 1234567890|get_digit:"4" }}
{{ 1234567890|get_digit:10 }}
{{ 1234567890|get_digit:15 }}
{{ "anqicms"|get_digit:2 }}
{{ "ANQICMS"|get_digit:2 }}
{{ "安企内容管理系统"|get_digit:2 }}
# 显示结果
1234567890
1234567890
9
7
1
1234567890
61
29
139