If I have a bunch of these in a textfile:
how do i take the chunks of info, separate them by year, and put each chunk (all 7 lines) into an array?Code:[Event "abc 1841"] [Date "1841-xx-xx"] [Black "x"] [White "Y"] [Site "Z"] [Result "0-1"] x1x2 [Event "abc 1841"] [Date "1841-xx-xx"] [Black "b"] [White "r"] [Site "Z"] [Result "0-1"] x122 [Event "def 1842"] [Date "1842-xx-??"] [Black "X"] [White "Y"] [Site "Z"] [Result "1/2-1/2"] z1z3
So in the example above, in the 1841 array, I would have:
and the 1842 array would have:Code:Array1(0) = [Event "abc 1841"] [Date "1841-xx-xx"] [Black "x"] [White "Y"] [Site "Z"] [Result "0-1"] x1x2 Array1(1) = [Event "abc 1841"] [Date "1841-xx-xx"] [Black "b"] [White "r"] [Site "Z"] [Result "0-1"] x122
The date could be anywhere from 1841 to 2004. The date will always be the last 4 chars at the end of "Date" (2nd line).Code:Array2(0) = [Event "def 1842"] [Date "1842-xx-??"] [Black "X"] [White "Y"] [Site "Z"] [Result "1/2-1/2"] z1z3
Thanks!




Reply With Quote