Multi-dimensional Split
Posted: Mon Apr 21, 2014 3:04 pm
This came up in a recent thread, the possibility to use the "Split" command (and conversely, I suppose, "Combine") with multi-dimensional arrays:
put "1,1,x" & return & "1,1,y" & return &"1,1,z" & return & "1,2,a" & return & "1,2,b" & return &"1,2,c" into temp
split temp by "comma & comma & return"
Would yield an array with:
1 1 x
1 1 y
1 1 z
1 2 a
1 2 b
1 2 c
Can the string be grokked correctly, in that the parser knows to expect two delimiters (commas) in each line (the return)? This looks like it would be easy to break, if, say. the "1" in the second line above was instead a "7". A great deal of order would be necessary to have this run smoothly. Same with going the other way:
Combine temp with comma and comma and return.
Craig Newman
put "1,1,x" & return & "1,1,y" & return &"1,1,z" & return & "1,2,a" & return & "1,2,b" & return &"1,2,c" into temp
split temp by "comma & comma & return"
Would yield an array with:
1 1 x
1 1 y
1 1 z
1 2 a
1 2 b
1 2 c
Can the string be grokked correctly, in that the parser knows to expect two delimiters (commas) in each line (the return)? This looks like it would be easy to break, if, say. the "1" in the second line above was instead a "7". A great deal of order would be necessary to have this run smoothly. Same with going the other way:
Combine temp with comma and comma and return.
Craig Newman