/* Usage: * jQuery.csv()(csvtext) returns an array of arrays representing the CSV text. * jQuery.csv("\t")(tsvtext) uses Tab as a delimiter (comma is the default) * jQuery.csv("\t", "'")(tsvtext) uses a single quote as the quote character instead of double quotes * jQuery.csv("\t", "'\"")(tsvtext) uses single & double quotes as the quote character * jQuery.csv(",", "", "\n")(tsvtext) カンマ区切りで改行コード「\n」 */ jQuery.extend({ csv: function(delim, quote, lined) { delim = typeof delim == "string" ? new RegExp( "[" + (delim || "," ) + "]" ) : typeof delim == "undefined" ? "," : delim; quote = typeof quote == "string" ? new RegExp("^[" + (quote || '"' ) + "]" ) : typeof quote == "undefined" ? '"' : quote; lined = typeof lined == "string" ? new RegExp( "[" + (lined || "\r\n") + "]+") : typeof lined == "undefined" ? "\r\n" : lined; function splitline (v) { // Split the line using the delimitor var arr = v.split(delim), out = [], q; for (var i=0, l=arr.length; i