/* 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) 繧ォ繝ウ繝槫玄蛻�j縺ァ謾ケ陦後さ繝シ繝峨圭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