(Lianja) CSV Enable Quotes
Explains the EnableQuotes property for the CSV class.
// The CSV in this example contains this: test;"123;abc";xyz
loCsv = createobject("CkCsv")
// EnableQuotes is .T. by default, but we'll explicitly set to .T. here:
loCsv.EnableQuotes = .T.
llSuccess = loCsv.LoadFile("qa_data/csv/enableQuotes.csv")
// Show row 0, column 0
? loCsv.GetCell(0,0)
// Show row 0, column 1
? loCsv.GetCell(0,1)
// Show row 0, column 2
? loCsv.GetCell(0,2)
// Output is:
// test
// 123;abc
// xyz
// -------------------------------------------
// Turn off EnableQuotes and see what happens:
loCsv2 = createobject("CkCsv")
loCsv2.EnableQuotes = .F.
llSuccess = loCsv2.LoadFile("qa_data/csv/enableQuotes.csv")
? loCsv2.GetCell(0,0)
? loCsv2.GetCell(0,1)
? loCsv2.GetCell(0,2)
? loCsv2.GetCell(0,3)
// Output is:
// test
// "123
// abc"
// xyz
release loCsv
release loCsv2
|