text sortType

Dar Scott dsc at swcp.com
Tue May 28 14:51:16 CDT 2013


I think this and Geoff's are good!  This one is more general if you can come up with some sort of metric or sortvalue for each item/list.  Geoff's is simpler for this case.  The speed difference will depend on the length of the list.  

Shouldn't the zero be put 'before' instead of 'after' to force a numerical sort?

Also, there is a shortcut.  

put char -6 to -1 of ("000000" & tKey) into tKey

Dar


On May 28, 2013, at 1:41 PM, Peter Haworth wrote:

> The following worked for me (with apologies ofr any asterisks that may be
> inserted into the script by my email client)
> 
> It assumes there won;t be any numbers > 6 digits.
> 
> *on* mouseUp
> 
>   *sort* lines of field "Field" by reformatLine(each)
> 
> *end* mouseUp
> 
> 
> *function* reformatLine l
> 
>   *local* tKey
> 
>   *put* word 1 to -2 of item 1 of l into tKey
> 
>   *repeat* 6-the length of word -1 of item 1 of l
> 
>      *put* zero after tKey
> 
>   *end* *repeat*
> 
>   *put* word -1 of item 1 of l after tKey
> 
>   *return* tKey
> 
> *end* reformatLine
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> _______________________________________________
> 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