Split an Array to Numeric with 2 Dimensions

Sannyasin Brahmanathaswami brahma at hindu.org
Sat Aug 18 12:43:17 EDT 2018


I decide to study up to improve my array management skills. Looked up the dictionary: element, columnDel, RowDelimiter etc Tools I never used.  But I can't fine a "one pass" split that takes a dBase dump like this and makes a 2nd  dimension. Other than to do it "manually"

Also I thought, after reading the dictionary, that the "element" would be "1" in

uDataArray[1][someValue]

But instead I was getting "someValue" -- so I am not understanding something there.

=====

apples|https://www.washington.com/neutral

orange|https://www.california.com|citrus

peaches|https://www.idaho.com|sweet

=======

## this works, but I wonder if it is optimal.

local aSetUp,aDataArray

put [thelist] into aSetUp

put "fruit" into t1Element

put "url" into t2Element

put "category" into t3Element

split aSetup by cr

set itemdel to "|"

Repeat for each line x in (the keys of aSetup)

        put item 1 of aSetUp[x] into aDataArray[x][t1Element]

        put item 2 of aSetUp[x] into aDataArray[x][t2Element]

        put item 3 of aSetUp[x] into aDataArray[x][t3Element]

end repeat


BR








More information about the use-livecode mailing list