当前位置: 软件>JavaScript软件
jQuery的CSV插件 jQuery CSV
本文导语: Convert CSV data into an array of arrays. // Convert CSV data into array of arraysjQuery.csv()("1,2,3n4,5,6n7,8,9n"); // = [ [1,2,3], [4,5,6], [7,8,9] ]// It handles quotesjQuery.csv()('a,"b,c",d'); // = [ ['a', 'b,c', 'd'] ]// You can use any delimiter, e.g. tabjQuery.csv("t")("atbnctdn"); // = ...
Convert CSV data into an array of arrays.
// Convert CSV data into array of arrays
jQuery.csv()("1,2,3n4,5,6n7,8,9n"); // = [ [1,2,3], [4,5,6], [7,8,9] ]
// It handles quotes
jQuery.csv()('a,"b,c",d'); // = [ ['a', 'b,c', 'd'] ]
// You can use any delimiter, e.g. tab
jQuery.csv("t")("atbnctdn"); // = [ ['a','b'], ['c','d'] ]
// Quick usage with AJAX:
jQuery.get(csvfile, function(data) { array = jQuery.csv()(data); });
// Using across multiple files
var getTSV = jQuery.csv("t");
jQuery.get(csvfile1, function(data) { array1 = getTSV(data); });
jQuery.get(csvfile2, function(data) { array2 = getTSV(data); });
jQuery.csv()("1,2,3n4,5,6n7,8,9n"); // = [ [1,2,3], [4,5,6], [7,8,9] ]
// It handles quotes
jQuery.csv()('a,"b,c",d'); // = [ ['a', 'b,c', 'd'] ]
// You can use any delimiter, e.g. tab
jQuery.csv("t")("atbnctdn"); // = [ ['a','b'], ['c','d'] ]
// Quick usage with AJAX:
jQuery.get(csvfile, function(data) { array = jQuery.csv()(data); });
// Using across multiple files
var getTSV = jQuery.csv("t");
jQuery.get(csvfile1, function(data) { array1 = getTSV(data); });
jQuery.get(csvfile2, function(data) { array2 = getTSV(data); });