sort by length of line (Weird)

dunbarx at aol.com dunbarx at aol.com
Mon Dec 12 11:55:23 EST 2011


Hmmm.


All that is what I tried in the first place, before writing everyone.


It turns out that I have a list that does not quite work, and that is what threw me. Can anyone verify that the following lines will not quite sort correctlyt?



DEZINCKING
RAZORBACKS
ZOOPLANKTONIC
ZINCKY
ZEBECK
ZADDICK
ZEBECKS
ZINCKED
ZIPLOCK
KAZACHKI
KAZACHOK
ZINCKING
ZWIEBACK
DEZINCKED
RAZORBACK
ZWIEBACKS


Put this list into a variable or field, and sort by the length of each. I get the same data back unchanged.


Other data does work as advertised. What is so special about it?


Thanks,


Craig Newman






-----Original Message-----
From: Mark Schonewille <m.schonewille at economy-x-talk.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Sun, Dec 11, 2011 6:54 pm
Subject: Re: sort by length of line


Hi Craig,

sort lines of myList by length(each)
sort lines of myList by the length of each
sort lines of myList by number of chars of each

"Each" is simply the element that's currently being sorted, as if you put a 
repeat loop into one line of syntax.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter 
today. 20% commission!

On 12 dec 2011, at 05:04, dunbarx at aol.com wrote:

> Sorry, should have made a new thread.
> 
> I can do this the long way, but is there a clever sortkey that will sort lines 
by the length of those lines?
> 
> In other words, if I have a variable myVar with:
> 
> aaaaaaa
> xxx
> bbbb
> 
> I want to write something like:
> 
> sort myVar by the length of each
> 
> to yield:
> 
> xxx
> bbbb
> aaaaaaa
> 
> Thanks,
> 
> Craig Newman


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the Use-livecode mailing list