Sorting A List of Words by Length of Characters
Posted: Sat Dec 24, 2011 5:54 pm
Hello Anyone,
I've been struggling to find a simple way to use the sort command to sort a list of words by the size (character length) of each word. For example, I want all the words with the same amount of letters to be grouped together in descending order. Before asking this question, I spent some hours playing with different lines of script, reading up on the sort command, etc. The following line is the closest I've come to making it work:
sort lines of field "textField" descending by the length of each
That line "mostly" works, but some of the groups of words with the same number of characters are out of order (not exactly descending). For instance, words that have 10 or more letters in them are strangely placed in between the group of words that have 2 characters and 1 character.
Any suggestions?
Thanks so much in advance.
I've been struggling to find a simple way to use the sort command to sort a list of words by the size (character length) of each word. For example, I want all the words with the same amount of letters to be grouped together in descending order. Before asking this question, I spent some hours playing with different lines of script, reading up on the sort command, etc. The following line is the closest I've come to making it work:
sort lines of field "textField" descending by the length of each
That line "mostly" works, but some of the groups of words with the same number of characters are out of order (not exactly descending). For instance, words that have 10 or more letters in them are strangely placed in between the group of words that have 2 characters and 1 character.
Any suggestions?
Thanks so much in advance.