Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Greg Jarman
RE: modifying table header [ reply ]  
2008-07-18 03:09
Hi James

Thanks for the response and great CSV library.

Cheers
Greg.


By: James Gray
RE: modifying table header [ reply ]  
2008-07-18 02:26
No, at this time FasterCSV::Table and FasterCSV::Row are read only structures. You will need to move them into a new structure to affect changes.

Also see FasterCSV.filter() though, just in case that meets your needs.

By: Greg Jarman
modifying table header [ reply ]  
2008-07-18 01:22
I can't seem to modify the header of a table. Is it supported?

table = FCSV.parse("x,y\n1,2\n3,4\n", :headers => true)

print table.to_csv
x,y
1,2
3,4

table.headers
=> ["x", "y"]

table.headers[0] = "z"
=> "z"

table.headers
=> ["x", "y"]