On Sep 25, 2014, at 9:24 PM, Peter Bogdanoff <bogdan...@me.com> 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, tKeys, tSortedGroups put the text of fld 1 into tText split tText by cr and null repeat for each line tLine in the HTMLtext of fld 1 add 1 to tLineNumber switch tLineNumber wrap 3 case 1 put tText[ tLineNumber ] into tKey put tLine & cr into tGroup break case 2 put tLine & cr after tGroup break case 3 put tGroup & tLine & cr into tArray[ tKey ] end switch end repeat put the keys of tArray into tKeys sort tKeys repeat for each line tKey in tKeys put tArray[ tKey ] after tSortedGroups end repeat set the HTMLText of fld 2 to tSortedGroups end sortGroupsOfLines Because this approach has only three references to objects, it's faster. How's that, Peter? -- Dick _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode