How do I replace a word in a string in the Anqi CMS template?
replace
The filter can replace the old word 'old' with the new word 'new' in a string and return the modified string.If `old` is empty, it will match at the beginning of the string and after each UTF-8 sequence.If new is empty, remove old.
How to use
replace
Usage of filters:
# 将旧的关键词替换为新的关键词
{{obj|replace:"old,new"}}
Use a comma to distinguish between 'old' and 'new'.
{{"欢迎使用安企CMS"|replace:"安企,anqi"}}
# 显示结果
欢迎使用anqiCMS
Sample Demo
{{"欢迎使用安企CMS"|replace:"安企,anqi"}}
# 显示结果
欢迎使用anqiCMS
{{"欢迎使用安企CMS"|replace:",-"}}
# 显示结果
-欢-迎-使-用-安-企-C-M-S-
{{"欢迎使用安企CMS"|replace:"安企,"}}
# 显示结果
欢迎安企CMS