converts a CSV string to a Javascript data array
text | string | a CSV string |
delimiter | object | the rows/columns delimiters used during CSV parsing |
array | a Javascript array with parsed values |
var data = webix.csv.parse("a,b\n,c,d"); // output[[a,b],[c,d]]
The delimiter is an object with the following properties:
var delimiter = {
rows: "\n", // the rows delimiter
cols: "\t" // the columns delimiter
}
var csv = '1-The Shawshank Redemption|2-The Godfather';
var delimiter = {rows:"|", cols:"-" };
var data = webix.csv.parse(csv, delimiter);
//output [["1", "The Shawshank Redemption"], ["2", "The Godfather, "1972"]]
You can change delimiters globally by setting webix.csv.delimiter.rows and webix.csv.delimiter.cols properties.
webix.csv.delimiter.rows = "\b";
webix.csv.delimiter.cols = "\v";
Back to top