How to get the number in the specified position in the Anqi CMS template?
get_digit
The filter can obtain the number at the specified position in the number, and the position is calculated from the countdown of the number to be obtained, and the starting position is 1. If the location to be retrieved does not exist, the entire number is returned. If the original number is a number, the obtained result is the number obtained by ASCII value -48 of the character at that position.
How to use
get_digit
How to use filters:
{{ obj|get_digit:number }}
For example, you need to obtain1234567890
Get the third last digit in the second, you can write it like this:
{{ 1234567890|get_digit:3 }} # Show results 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 }} # Display results 1234567890 1234567890 9 7 1 1234567890 61 29 139