(Tcl) CSV Enable Quotes
Explains the EnableQuotes property for the CSV class.
load ./chilkat.dll
# The CSV in this example contains this: test;"123;abc";xyz
set csv [new_CkCsv]
# EnableQuotes is 1 by default, but we'll explicitly set to 1 here:
CkCsv_put_EnableQuotes $csv 1
set success [CkCsv_LoadFile $csv "qa_data/csv/enableQuotes.csv"]
# Show row 0, column 0
puts [CkCsv_getCell $csv 0 0]
# Show row 0, column 1
puts [CkCsv_getCell $csv 0 1]
# Show row 0, column 2
puts [CkCsv_getCell $csv 0 2]
# Output is:
# test
# 123;abc
# xyz
# -------------------------------------------
# Turn off EnableQuotes and see what happens:
set csv2 [new_CkCsv]
CkCsv_put_EnableQuotes $csv2 0
set success [CkCsv_LoadFile $csv2 "qa_data/csv/enableQuotes.csv"]
puts [CkCsv_getCell $csv2 0 0]
puts [CkCsv_getCell $csv2 0 1]
puts [CkCsv_getCell $csv2 0 2]
puts [CkCsv_getCell $csv2 0 3]
# Output is:
# test
# "123
# abc"
# xyz
delete_CkCsv $csv
delete_CkCsv $csv2
|