String comparisons
Jaime Garza <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <9FFDAB70F49C7F43A160826020F7CDF9745C5DD1@CORPEX14-MBN1.us.responsys.com> |
In the code on ComparisonExpression:
else if(ltm instanceof TemplateScalarModel && rtm instanceof TemplateScalarModel) {
if(operation != EQUALS && operation != NOT_EQUALS) {
throw new TemplateException("Can not use operator " + opString + " on string values.", env);
}
String first = EvaluationUtil.getString((TemplateScalarModel)ltm, left, env);
String second = EvaluationUtil.getString((TemplateScalarModel)rtm, right, env);
comp = env.getCollator().compare(first, second);
}
Collator supports "less", "less than", "greater" and "greater than" semantics.
What is the caveat on not allowing anything but equals and not equals? There must be a reason.
(Having all the semantic behaviors would be a great way to deal with date comparisons when I need to convert dates to text, and back to a date.)
Thanks
Jaime
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan