Convert letters on the mobile phone keypad to numbers

How to translate mobile phone keyboard letter to number in Anqi CMS template?

phone2numericThe filter can convert letters on a mobile phone's numeric keyboard to numbers. The conversion relationship is:

{
	"a": "2", "b": "2", "c": "2", "d": "3", "e": "3", "f": "3", "g": "4", "h": "4", "i": "4", "j": "5", "k": "5",
	"l": "5", "m": "6", "n": "6", "o": "6", "p": "7", "q": "7", "r": "7", "s": "7", "t": "8", "u": "8", "v": "8",
	"w": "9", "x": "9", "y": "9", "z": "9"
}

Usage method

phone2numericHow to use the filter:

{{ obj|phone2numeric }}

For example, if you need to concatenate999-PONGO2If converted to numbers, it can be written like this:

{{ "999-PONGO2"|phone2numeric }}
# 显示结果
999-766462

Example Demonstration

{{ "999-PONGO2"|phone2numeric }}
# 显示结果
999-766462