为什么当我运行这段代码时,下载的数据似乎已经从第一行中截取了一些信息?
NSURL *url = [NSURL URLWithString:@"http://ichart.finance.yahoo.com/table.csv? s=GOOG&d=6&e=27&f=2012&g=d&a=6&b=25&c=2011&ignore=.csv"];
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
NSURLConnection *connection= [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection start];
然后数据在这里排序:
NSString *strData = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
strData = [strData stringByReplacingOccurrencesOfString:@"Date,Open,High,Low,Close,Volume,Adj Close" withString:@""];
NSArray* arrUncleanDataLine = [strData componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
NSMutableArray *arrCleanDataLine = [[NSMutableArray alloc]init];
NSString *temp = [[NSString alloc]init];
顶线被剪掉。为什么是这样?是因为 NSData 只能保存一定数量的数据吗?