[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Nov 6 22:29:37 1994 
Subject:generalising alphabefore for field-based string sorting 
From:"A.Sloman" 
Volume-ID:941107.01 

Has anyone a string comparison program that can be told to use
the N'th field with fields defined by some user-specified character,
e.g. space or tab.

It would be nice to have such a thing partly in order to generalise
ved_smr (Sort Marked Range).

I have a first draft implementation, allowing things like
    ENTER smrn 3
        Sort marked range using third space-delimited field
    ENTER smrn -f 2
        Sort marked range using second field and fold upper into
        lower case.

Mine's a quick hack. If someone else has a good implementation of this
sort of thing I'd be interested to see it. I'll post mine if there isn't
already something better.
Aaron
PS
For the comparison, I've used a procedure defined thus

    field_before(s1, s2, startloc, endloc, fold) -> boolean

     s1 and s2 are strings, startloc and endloc are procedures.

     fold is a boolean to control mapping of upper to lower case

     If string s1 is alphabetically earlier than s2 with the
     comparison starting at a locations startloc(s1) and startloc(s2),
     and ending at locations defined by
            endloc(s1, startloc(s1))
            endloc(s2, startloc(s2))
     then return true, otherwise false.

Aaron