freemaker学习笔记--内置方法
一:数字型
<#assign answer=42/>
${answer}
${answer?string}? <#-- the same as ${answer} -->
${answer?string.number}(文章来源 www.iocblog.net)
${answer?string.currency}
${answer?string.percent}
<#setting number_format="0.###E0"/>
${12345?string("0.####E0")}??
${answer?string("number")}?等同于:${answer?string.number}.
二:日期型:
预定义格式包括:short?,middle和long。
Built-in
Returns?true?if the value is a ...
is_string
string
is_number
number
is_boolean
boolean
is_date
date (all types: date-only, time-only and date-time)
is_method
method
is_transform
transform
is_macro
macro
is_hash
hash
is_hash_ex
extended hash (i.e. supports??keys?and??values)
is_sequence
sequence
is_collection
collection(文章来源 www.iocblog.net)
is_enumerable
sequence or collection
is_indexable
sequence
is_directive
macro or transform
is_node
node
namespace:返回宏变量的命名空间,只能用于宏。
new:创建一个TemplateModel实现的变量。
<#assign word_wrapp = "com.acmee.freemarker.WordWrapperTransform"?new()>