Re: Basic Euphoria Sequences
- Posted by Rad <radhx at rediffmail.com> Feb 10, 2006
- 491 views
Some Slacker wrote: > > now for some of the strings i need to be able to seperate out the strings > to be a list(for a listview, or a combo box for example) so that some > of the elements of the sequence are single strings or just atoms, or > formatted for time or currency etc. and some of the elements are themselves > their own list of strings... > > if the data could look something like... > > {{{time},{time2},{time3},{time4},{string},{string2},{atom},{atom (formatted > for currency)}, {atom (again currency)}, {string3} etc. }} > > now what if the strings are lists for a combo box, can i just add elements > to each of these strings? > > > {{{time},{time2},{time3},{time4},{{string1},{string1a}},{{string2},{string2a}}, > {atom},{atom (formatted for currency)}, {atom (again currency)}, > {string3} etc. }} > You have to define an original sequence containing sequences. Hope following example will help.
sequence testSeq testSeq = repeat({}, 14) for i = 1 to 14 do testSeq[i] = append(testSeq[i], i) -- first item of testSeq[1] is atom testSeq[i] = append(testSeq[i], {}) -- second item of testSeq[1] itself is a sequence testSeq[i][2] = append(testSeq[i][2], i) -- first item of the testSeq[1][2] is again atom... and so on end for VOID = message_box(sprintf("Length of testSeq: %d", length(testSeq)), "Info", MB_ICONINFORMATION) VOID = message_box(sprintf("Length of testSeq[1]: %d", length(testSeq[1])), "Info", MB_ICONINFORMATION) VOID = message_box(sprintf("Length of testSeq[1][2]: %d", length(testSeq[1][2])), "Info", MB_ICONINFORMATION)
Regards, Rad.