Intelligent sorting: A bit of a poser
Michael Kann
mikekann at yahoo.com
Thu Jul 1 10:28:35 EDT 2010
Another way to do it:
function f_sort_num 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_sort_num
function f_sort_word x
put "0123456789" into n
repeat while last char of x is in n
delete last char of x
end repeat
return x
end f_sort_word
on mouseUp
sort fld 1 numeric by f_sort_num(each)
sort fld 1 by f_sort_word(each)
end mouseUp
--- On Thu, 7/1/10, Colin Holgate <coiin at verizon.net> wrote:
> From: Colin Holgate <coiin at verizon.net>
> Subject: Re: Intelligent sorting: A bit of a poser
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Date: Thursday, July 1, 2010, 9:25 AM
>
> On Jul 1, 2010, at 10:16 AM, DunbarX at aol.com
> wrote:
>
> > Hold everything. Doesn't work.
>
> I noticed. This does though:
>
> on mouseUp
> put separateNumbers(fld yourField)
> into temp
> sort temp numeric by
> item 2 of each & item 1 of each
> sort temp by item 1 of each
> replace comma with empty in temp
> put temp into fld yourField
> end mouseUp
>
> function separateNumbers var
> repeat with a = 1 to the number of lines
> in var
> repeat with b = 1 to the number of
> chars in line a of var
> if char b of line a of
> var is in "0123456789" then
> put comma before
> char b of line a of var
> exit repeat
> end if
> end repeat
> end repeat
> return var
> end separateNumbers
>
>
> _______________________________________________
> 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