Silly Sort Question

J. Landman Gay jacque at hyperactivesw.com
Tue Oct 18 14:18:54 EDT 2005


Gregory Lypny wrote:
> Hello everyone,
> 
>     I have a simply twelve-line list with the name of a month as the  
> first word on each line.  The list is not in order, and I'd like to  
> sort it January to December using the monthNames.  Don't know how.
> 
>         sort lines of theList by first word in each [need connection  to 
> the monthNames here]
> 
>     Otherwise, I suppose a simple repeat loop, although clunky,  would do.

You can sort any container by using a custom function you write 
yourself. This should do it:

on mouseUp
   sort lines of fld 1 numeric by sortmonths(each)
end mouseUp

function sortmonths pMonth
   return lineoffset(pMonth, the monthnames)
end sortmonths


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list