Create data for CSV file : csv « Development « Ruby






Create data for CSV file


cd=[]
cd[0]=CSV::ColData.new
cd[0].data="joe"
cd[0].isNull=false
cd[1]=CSV::ColData.new
cd[1].data=27
cd[1].isNull=false
cd[2]=CSV::ColData.new
cd[2].data=32000
cd[2].isNull=false

csv_str=""
c = CSV::createLine(cd, 3, csv_str)

 








Related examples in the same category

1.Read CSV file
2.Update a CSV file
3.Parse one CSV file line
4.Reading and Searching CSV Data
5.use CSV alongside the File class
6.loading the data from a CSV-formatted file into an array is with CSV.read:
7.pick out the first person in the data called Laura:
8.find the people in your database whose ages are between 20 and 40:
9.Saving Data Back to the CSV File