On 2018-05-14 14:39:36 Rick McGuire wrote:
> On Mon, May 14, 2018 at 3:27 PM, Leslie Turriff <[email protected]> wrote:
>         It's frustration, really; I didn't mean to be sharp.  It seems as
> if much of the time, things that seem straightforward, in ooRexx turn out
> to require considerable additional unexpected coding.
>
> 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))

        Uh-huh. I notice, though, (and this might just be my misunderstanding 
again) 
that
'5.1.3.33. compare

Returns 0 if the argument string is identical to the receiving string. 
Otherwise, returns the position of the first character that does not match. 
The shorter string is padded on the right with pad if necessary. The default 
pad character is a blank.'

while

'5.1.3.34. compareTo

Performs a sort comparison of the target string to the string argument. If the 
two strings are equal, 0 is returned. If the target string is larger, 1 is 
returned. -1 if the string argument is the larger string. The comparison is 
performed starting at character n for length characters in both strings. n 
must be a positive whole number. If n is omitted, the comparison starts at 
the first character. length must be a non-negative whole number. If omitted, 
the comparison will take place to the end of the target string.'

so shouldn't I be providing a new compareTo, not compare, for this?


------------------------------------------------------------------------------
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