Consider however that you can get the keys of an array and sort them as an
index to the array.
put the keys of myArray into theKeys
sort theKeys ascending numeric
repeat for each line theCurrentKey in theKeys
put myArray [theCurrentKey] into theValue
— do something with theValue
end repeat
Dick, this works very well. Good to learn about the wrap operator.
Peter, your solution didn’t work because the htmlText contains various
characters in the link tags that messes up the sorting.
Thanks both!
Peter
On Sep 26, 2014, at 3:06 AM, Dick Kriesel wrote:
> On Sep 25, 2014, at 9:24 PM,
Thanks very much, Dick and Peter! I'll try these out.
On Sep 26, 2014, at 8:55 AM, "Peter M. Brigham" wrote:
> On Sep 26, 2014, at 12:24 AM, Peter Bogdanoff wrote:
>
>> My first foray into arrays:
>>
>> I want to sort a 2D array by one of the keys.
>>
>> The data consists of several 2-line g
On Sep 26, 2014, at 12:24 AM, Peter Bogdanoff wrote:
> My first foray into arrays:
>
> I want to sort a 2D array by one of the keys.
>
> The data consists of several 2-line groups that are in a field. The lines
> contain styled and linked characters that I want to retain after sorting:
>
> pea
On Sep 25, 2014, at 9:24 PM, Peter Bogdanoff wrote:
> My first foray into arrays
Hi, Peter.
For this foray, you could use a one-dimensional array, containing the three
lines of html text for each plain text key:
command sortGroupsOfLines
local tText, tLineNumber, tGroup, tKey, tArray, tK
My first foray into arrays:
I want to sort a 2D array by one of the keys.
The data consists of several 2-line groups that are in a field. The lines
contain styled and linked characters that I want to retain after sorting:
peaches
pears
apples
oranges
plums
grapes
I want to sort the data by l