pub fn to_delimited<R, C, S>(rows: R, delimiter: char) -> StringExpand description
The table as delimited text with delimiter between fields ('\t' for TSV), laid out on
its grid as the module describes.
A field holding the delimiter, a double quote or a line break is enclosed in double quotes, with each quote inside doubled; every other field is written as it is.
use unparser_shared::csv::{to_delimited, Cell};
// ┌────────┬───────────┐
// │ Region │ Sales │
// │ ├─────┬─────┤
// │ │2024 │2025 │
// ├────────┼─────┼─────┤
// │ North │ 10 │ 12 │
// └────────┴─────┴─────┘
let rows = [
vec![Cell::new("Region", 2, 1), Cell::new("Sales", 1, 2)],
vec![Cell::single("2024"), Cell::single("2025")],
vec![Cell::single("North"), Cell::single("10"), Cell::single("12")],
];
assert_eq!(
to_delimited(rows, '\t'),
"Region\tSales\t\r\n\t2024\t2025\r\nNorth\t10\t12\r\n"
);