Append or concatenate to each element in sequence

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu