On 2018-05-14 14:39:36 Rick McGuire wrote:
> It is written this way because it gives you the flexibility to determine
> how things work rather than waiting for a developer to decide some feature
> you want is more important than some other feature that somebody else
> wants.  Frankly, a request for a NumericColumnComparator would fall pretty
> far down the list of things I might work on, but once you have written one
> yourself, you can reuse it over and over again in as many places you want. 
>
> Here is a quick version (untested):
> ::CLASS 'NumericColumnComparator' MIXINCLASS Comparator Public
> ::METHOD init
>
> expose start length precision
> use strict arg start, length, precision  = (digits())
>
> ::METHOD compare
>
> expose start length precision
>
> use strict arg left, right
>
> numeric digits precision
> -- the sign from the subtraction result is the correct return
> -- value for an ordering comparison.
> return sign(substr(left, start, length) - substr(right, start, length))

        And your example does the job very nicely.  Thank you very much, Rick.

Leslie


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to