Sort so that "Hello" is always before "hello"
dochawk at gmail.com
Thu May 18 23:50:22 CEST 2017
On Thu, May 18, 2017 at 2:20 PM, Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:
> What you are wanting to do is a recursive function that sorts within each
> word. If the first character is all you care about, it would be easy
> enought to code, but if *every* character comes into play, the problem
> becomes grossly complex. This isn't a sort problem. It's a filing order
sort the lines of mycontainer by mysort of each
where mysort is a function previously defined.
Or, perhaps more creatively
repeat for each line theLin in theData
put theLin into arry[mysort(theLin)
put the keys of arry into srtVals
sort lines of srtVals
repeat for each line theLin in srtVals
put arry[theLin] & cr after newData
where mysort() simply rearranges the characters into order AaBb etc. (so
"A" maps to "a", "a" maps to "b", and so forth, leaving the rest of the
ascii intact. Or perhaps it could remap the symbols & numbers to
preference, too. There are something like 95! possible mappings . . .
Dr. Richard E. Hawkins, Esq.
More information about the use-livecode