Support for Version's

Feb 23, 2010 at 3:42 AM

Our application requires parsing and comparison of Version types.

e.g. '1.0' > '0.0.0.1' == true

Any suggestions on how to add support for Version types much like the support for DateTime types? Would I need to make changes to both the ANTLR grammar and make modifications to NCalc? Or something simpler and less invasive?

Coordinator
Feb 27, 2010 at 6:46 AM

I suppose it's for managing sort of a rule engine, and thus people must have knowledge of what a version number is. So I would suggest you to create a custom function named CompareVersion(v1, v2), which would make this job. This would return -1, 0 or 1 depending on the result.

It's the easiest way to handle it.

Sébastien