This can't be done within a template unless you create a "tool" (a
java class that you put in the context to perform a function rather
than be displayed) with a method that will do this for you.
so make a class like
public BitTool {
public int and(int a, int b) {
return a & b;
}
}
put an instance of this class in your context under the key "bit" and the do
#set( $value = $bit.and(7, 4) )
i think that should do the trick. but i can't help but say that i
think this is probably not something appropriate to do within a
template. :)
On 7/24/07, 于世英 <[EMAIL PROTECTED]> wrote:
Hi, I'm a newbie to Velocity. Can anybody tell me how I can perform bit
operation in directives such as "set"? for example, I want to get integer
"4" by a sentence like:
#set ($value = 7 & 4)
I tried the above sentence and of course failed. how to accomplish it? or if
there is any alternative way to accomplish the function?
thanks a lot.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]