I've posted this topic on bytes.com also, pls help me http://bytes.com/topic/javascript/answers/869610-convert-google-finance-data-array
regards, Nitin Sawant On May 20, 4:03 pm, Nitin Sawant <nitin.jays...@gmail.com> wrote: > Hello Liam, > Thanks for your reply, > > i'm retrieving csv file from google finance and parsing it, however > the script which i wrote doesn't replace newline char from csv file > with comma, I want to convert csv file to javascript array. > > <html> > <head> > <title>- Another CSV parser -</title> > <script type="text/javascript" src="flotr/jquery.js"></script> > <script type="text/javascript"> > function loadData(){ > $.get("http://finance.google.com/finance/historical", > { > q:'GOOG', > startdate:'Apr 1 2009', > enddate:'May 1 2009', > start:'225', > num:'25', > output:'csv' > }, > function(data) > { > // Writing output into div > $("#csvDiv").html(data); > $("#csvDiv").hide(); > ConvertToArray(data); > } > ); > } > > function ConvertToArray(data){ > var myArr=$("#csvDiv").html(); > myArr=myArr.replace("\n",",");//this line doesn't work > myArr=myArr.split(','); > document.writeln("array length is: "+myArr.length+"<br/>"); > > //show all elements of array > var i=0; > for (i; i<myArr.length; i++) { > document.writeln(myArr[i]+'<br />'); > } > } > </script> > </head> > <body> > <div id="csvDiv"> > > </div> > <script type="text/javascript"> > loadData(); > </script> > <!-- > http://finance.google.com/finance/historical?q=GOOG&startdate=May+1%2... > --> > </body> > </html> > > On May 20, 3:56 pm, Liam Byrne <l...@onsight.ie> wrote: > > > > > That code that you posted is replacing a newline with nothing - the > > comma is BETWEEN the parameters and is not one of them > > > Try csvString=csvString.replace('\n',','); > > > Nitin Sawant wrote: > > > Hello frendz, > > > I'm trying to replace newline char frm Google finance csv > > > file with comma but its not happening pls help. > > > >http://finance.google.com/finance/historical?q=GOOG&startdate=May+1%2... > > > > I'm using following code > > > > csvString=csvString.replace('\n',''); > > > > I think there is some platform newline char issue. > > > > how to do this using jquery? > > > > pls help > > > ------------------------------------------------------------------------ > > > > No virus found in this incoming message. > > > Checked by AVG -www.avg.com > > > Version: 8.5.339 / Virus Database: 270.12.35/2124 - Release Date: > > > 05/20/09 06:22:00