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