Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a Column in a Array
#1
Guys,

I got a table from web using the code below.

Code:
Copy      Help
HtmlDoc k.InitFromText(s)
ARRAY(str) a
k.GetTable(0 a)
int i nc=7
ICsv x._create; x.ColumnCount=nc
for i 0 a.len/nc
,str& firstCell=a[i*nc]
,firstCell.rtrim("")
,x.AddRowSA(i nc &firstCell)

str csv; x.ToString(csv); out csv


Now I'd like to insert a new column in this Table with a string which I've created (called 'sy') in each line.

How can I do that ?

Thanks a lot for helping.
#2
If using ICsv:
x.InsertColumn(column_index_or_minus_one)

ARRAY does not have an 'insert column' function.
Need to create new array and copy to it each element of old array plus the new column values.
Or convert ARRAY(str) to ICsv, add column to ICsv, convert ICsv to ARRAY(str). ICsv has functions to convert from/to ARRAY(str).
#3
Ok. Thanks!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)