Intelligent sorting: A bit of a poser
Michael Kann
mikekann at yahoo.com
Thu Jul 1 09:15:19 EDT 2010
Klaus and Colin are the go-to guys. Here's a solution that is a bit more general. If you have different words before the numbers appear you can do the following. I'm sure it's as slow as molasses in winter, but it might give you some ideas.
Mike
------------------------------------
-- data in fld 1
------------------------------------
img1
lions10
img11
tigers2
img201
bears3
img4
------------------------------------
function f x
put "0123456789" into n
repeat while char 1 of x is not in n
delete char 1 of x
end repeat
return x
end f
on mouseUp
sort fld 1 numeric by f(each)
end mouseUp
------------------------------------
------------------------------------
--- On Thu, 7/1/10, FlexibleLearning <admin at FlexibleLearning.com> wrote:
> From: FlexibleLearning <admin at FlexibleLearning.com>
> Subject: Intelligent sorting: A bit of a poser
> To: use-revolution at lists.runrev.com
> Date: Thursday, July 1, 2010, 7:27 AM
> I have a list of words, each ending
> in a number...
>
> img1
> img10
> img11
> img2
> img201
> img3
> img4
>
> How do I sort them so they are in the visually correct
> numerical order, like
> this? ...
>
> img1
> img2
> img3
> img4
> img10
> img11
> img201
>
> /H
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list