How to check whether it's an empty string macro param ?

Albert Kam <[email protected]> Tue, 30 Jul 2013 16:51:37 +0700
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAMT20g9-bUxFuZYUd7xiH8oy7BvO9_Hx5DQ-FPx8x8uiKcDCoQ@mail.gmail.com>
I am currently using some macros that can accept a param, which can be
string or sequence like this :
<#macro test param>
</#macro>

But i want the param to be optional, so, i want to put a default value on
it, and check whether the param is specified or not :
<#macro test param="">
    <#if notEmptyString(param)>
        ....
    <#else>
        ....
    </#if>
</#macro>

And here's my function on checking the emptiness of the param :
<#function notEmptyString value>
<#return !(value?is_string) || value != "">
</#function>

Altough i havent faced any problems yet, i have my own doubts with this
function, since the param can be of multiple types which will pass the
?is_string. If so, how do i do the checking correctly ?

Thank you ..

-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user