Append or concatenate to each element in sequence
- Posted by Terry Constant <EUforum at terryconstant.com> Aug 20, 2004
- 497 views
Is there a better/faster way to concatenate or append to each element in a sequence than by using a loop, something like illustrated below?
sequence s1 global function seqConcat(sequence srcSeq, object toAppend) sequence dstSeq, curElement dstSeq = {} for i = 1 to length(srcSeq) do curElement = srcSeq[i] & toAppend dstSeq = append(dstSeq, curElement) end for return dstSeq end function --seqConcat() s1 = seqConcat({"abc","def","ghi"}, '\n')
My main concern is speed since I will be doing such operations on some large sequences. Terry Constant