freemarker - startwith 以 Apache free 标记结尾并包含在其中
问题描述
如何在
. string
starts with
_ ends with
_ 是否有任何可用的预定义contains
apache free marker
function
HelloIamShruti
IamShrutiHello
ShrutiHelloSharma
如果我想检查starts with "Hello" first string should be returned
如果我想检查ends with "Hello" second string should be returned
如果我想检查contains "Hello" last string should be returned
解决方案
可用于您的请求的 Freemarker 方法是:
- 开始于,例如。
"redblue"?starts_with("red")
将返回真。 - 结束,例如。
"redblue"?ends_with("red")
将返回假。 - 包含,例如。
<#if "piceous"?contains("ice")>It contains "ice"</#if>
将显示消息
当您希望单词被包含但不在开头或结尾时,只需添加一个 if 条件来检查 ifstarts_with
和ends_with
result 为 false。
推荐阅读
- python - df.append 正在创建新列而不是附加到现有列
- nat - 为什么 Ngrok 访问会遇到错误 502 Bad Gateway?
- matlab - MATLAB 中的布冯针
- python - 在python 3中将数据框值转换为范围值
- css - custom.css 加载延迟,而引导样式首先显示几秒钟
- .net - 如果后台线程不访问 Office 对象模型,是否需要在 MS Office 加载项中作为 STA 线程运行?
- asp.net-mvc - 为列表创建一个隐藏输入并将其发送回 mvc 核心中的帖子
- c# - 无法从克隆的仓库构建项目
- markdown - 如何在 Microsoft Teams 中粘贴 Markdown?
- java - 在 Eclipse 中为 Java 和 Java EE 使用相同的工作区