开发者

reading arabic text from a txt file in iphone

I am working on app where I need to display arabic text from a text file. I am using foll开发者_C百科owing code:

NSString *fileContents = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSArray *lines = [fileContents componentsSeparatedByString:@"\n"];
NSLog(@"%@",[lines objectAtIndex:0]);

I get about 60 records in this array lines. But when I try to print the data it does not print anything.


If the file starts with a newline, the first element in lines will be just an empty string. Try printing out the whole array instead, just to verify that your code is working as intended:

 NSLog(@"%@", lines);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜