freemarker 的内建函数 contains 的使用:
<#if employee.departments?contains(department)>checked="checked"</#if>
其中departments是一个集合,而department是departments集合里的一个元素。contains函数可以判断出,元素department是否存在于集合departments里,最终返回一个Boolean
contains是freemarker的内建函数,即自带的
。
FreeMarker 的内建函数有:
chunk, is_date, last, root, j_string, round,
contains
,
is_hash, long, float, ends_with, namespace, matches, time,
values, seq_last_index_of, uncap_first, byte, substring,
is_transform, web_safe, groups, seq_contains, is_macro, index_of,
word_list, int, is_method, eval, parent, xml, number,
capitalize, if_exists, rtf, node_type, double, is_directive,
url, size, default, floor, ceiling, is_boolean, split,
node_name, is_enumerable, seq_index_of, is_sequence, sort,
is_node,
sort_by, left_pad, cap_first, interpret,
children, node_namespace, chop_linebreak, date, short,
last_index_of, is_collection, ancestors, length, trim,
datetime, is_string, reverse, c, keys, upper_case, js_string,
has_content, right_pad, replace, is_hash_ex, new, is_number,
lower_case, is_indexable, string, exists, html, first
本文介绍了Freemarker模板引擎中的contains函数用法,该函数用于判断集合中是否包含某个元素,并返回布尔值。此外,还列举了Freemarker的其他内建函数。
8781

被折叠的 条评论
为什么被折叠?



