Basic sorting problem
David Bovill
david at openpartnership.net
Wed May 7 06:47:59 EDT 2008
If I am not doing something wrong I think this is a bug - if so it would be
good to confirm on other platforms as it is pretty basic. I am trying to
sort lines by the number of words in each line. I can do it with the nuber
of chars but not the number of words or tokens. Here are the test scripts:
on test_CharSort
> put object_GetNames() into objectNames
>
> -- this is sorting fine!
> sort objectNames by the number of chars of each
>
> repeat for each line someLine in objectNames
> put the number of chars of someLine & tab & someLine & CR after
> someResult
> end repeat
> put someResult
> end test_CharSort
>
> on test_WordSort
> put object_GetNames() into objectNames
>
> -- why is this not sorting?
> sort objectNames by the number of words of each
>
> repeat for each line someLine in objectNames
> put the number of words of someLine & tab & someLine & CR after
> someResult
> end repeat
> put someResult
> end test_WordSort
>
> on test_TokenSort
> put object_GetNames() into objectNames
>
> -- why is this not sorting?
> sort objectNames by the number of tokens of each
>
> repeat for each line someLine in objectNames
> put the number of tokens of someLine & tab & someLine & CR after
> someResult
> end repeat
> put someResult
> end test_TokenSort
>
> function object_GetNames
> repeat with controlNum = 1 to the number of controls
> put the long name of control controlNum into longName
> put longName & CR after objectNames
> end repeat
> delete char -1 of objectNames
> return objectNames
> end object_GetNames
A fix now is to sort using a function - now if only I could remember the
syntax for that....
More information about the use-livecode
mailing list