identifying variables - yep, that'll do it.

Barry Levine themacguy at macosx.com
Wed May 14 16:14:01 CDT 2003


Dar,

Appending the var name to the digit is what I finally came up with 
(4A,5B,3C would sort descending numeric as 5B,4A,3C). So all I have to 
do is examine the last char of the first item to know which var was 
"the largest" and then act accordingly.

I tried the following in the Message box:

put "27x","31y","3c" into tempStuff
sort items of tempStuff descending numeric
put tempStuff

The result was:   31y,27x,3c

So it seems that even 2-digit numbers are recognized properly in this 
sort.

*whew* What a relief!

Thanks,
Barry


On Wednesday, May 14, 2003, at 01:40 PM, 
use-revolution-request at lists.runrev.com wrote:

> Message: 2
> Date: Wed, 14 May 2003 11:47:05 -0600
> Subject: Re: Identifying variables
> From: Dar Scott <dsc at swcp.com>
> To: use-revolution at lists.runrev.com
> Reply-To: use-revolution at lists.runrev.com
>
>
> On Wednesday, May 14, 2003, at 11:20 AM, Barry Levine wrote:
>
>> I have three variables - let's use A, B, and C - that contain whole
>> numbers anywhere from 0 to 5; it is probably that at least two of the
>> vars will contain identical numbers. I sort them descending using:
>>
>> put A,B,C into theVars
>> sort items of theVars desending numeric
>>
>>
>> Now the three vars can be in any order. How do I know which var is now
>> first in the order?
>
> Here are three things to try:
>
> 1
> Append the name to the digit and sort that.  (if the numbers are
> actually greater than a single digit then format them fixed length.)
>




More information about the use-livecode mailing list