sort by length of line (Weird)
dunbarx at aol.com
dunbarx at aol.com
Mon Dec 12 20:18:26 EST 2011
I wanted a text sort. I see that LC resolves the length function as a number, the length of the line in question loaded into the local variable each. So a word with 10 chars is sorted before a word with 9 chars.
It is the loading of "each" that makes this correct, and sensible. Mark, you will agree if you think about it. It isn't a matter of LC being friendly, as I so glibly suggested.
Sorting numeric fixes the misunderstanding. I see, more and more, that this is proper behavior for LC, given the strict syntax of the function.
I'm OK with it.
Craig
-----Original Message-----
From: Bob Sneidar <bobs at twft.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Mon, Dec 12, 2011 1:58 pm
Subject: Re: sort by length of line (Weird)
It is doing just that, only it's doing a text sort of the numbers:
1
10
100
11
12
etc.
He wants a NUMERIC sort of the numbers. Hence sort myVar numeric by the length
of each
Bob
On Dec 12, 2011, at 11:56 AM, Mark Wieder wrote:
> OK - that's just weird. I see what's going on, but what I'd expect is what (I
> think) Craig expects - that I'd get a list of the strings sorted by their
> character lengths.
_______________________________________________
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