`

freemarker 的内建函数 contains 的使用

    博客分类:
  • SHH
阅读更多

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

 

 

 

分享到:
评论
1 楼 番茄有益 2009-10-21  
contains 是 string 的方法,对于List,Collection 应该使用seq_contains

相关推荐

Global site tag (gtag.js) - Google Analytics