Sample code for 30+ languages & platforms
Rust

CSV Enable Quotes

Explains the EnableQuotes property for the CSV class.

Chilkat Rust Downloads

Rust

// The CSV in this example contains this:   test;"123;abc";xyz

let csv = chilkat::Csv::new();

// EnableQuotes is true by default, but we'll explicitly set to true here:
csv.set_enable_quotes(true);
let _ = csv.load_file("qa_data/csv/enableQuotes.csv").is_ok();

// Show row 0, column 0
println!("{}", csv.get_cell(0, 0).unwrap_or_default());
// Show row 0, column 1
println!("{}", csv.get_cell(0, 1).unwrap_or_default());
// Show row 0, column 2
println!("{}", csv.get_cell(0, 2).unwrap_or_default());

// Output is: 
//  test
//  123;abc
//  xyz

// -------------------------------------------
// Turn off EnableQuotes and see what happens:

let csv2 = chilkat::Csv::new();
csv2.set_enable_quotes(false);

let _ = csv2.load_file("qa_data/csv/enableQuotes.csv").is_ok();

println!("{}", csv2.get_cell(0, 0).unwrap_or_default());
println!("{}", csv2.get_cell(0, 1).unwrap_or_default());
println!("{}", csv2.get_cell(0, 2).unwrap_or_default());
println!("{}", csv2.get_cell(0, 3).unwrap_or_default());

// Output is:

//  test
//  "123
//  abc"
//  xyz