iOS开发代码:从文本文件中读取内容到字符串里.docxVIP

  • 137
  • 0
  • 约6.27千字
  • 约 11页
  • 2021-04-12 发布于天津
  • 举报

iOS开发代码:从文本文件中读取内容到字符串里.docx

iOS 开发代码:从文本文件中读取内容到字符串里 NSError *error; NSString *textFileContents = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@ ” myTextFile ” ofType:@ ” txt ”] encoding:NSUTF8StringEncoding error: amp; error]; // If there are no results, something went wrong if (textFileContents == nil) { // an error occurred ” , [error”, [lines ” , [error ”, [lines localizedFailureReason]); NSArray *lines = [textFileContents componentsSeparatedByString:@ ”” ]; NSLog(@” Number of lines in the file:%d count] );[IOS] 读取本地文件内容 NSString*filePath=[[NSBundlemainBundle] pathForResource:@1ofType:@tx

文档评论(0)

1亿VIP精品文档

相关文档