NSString *file = @"/Users/onlyou1991/Desktop/11.txt”;
//读取文件成字符串
NSString *dataStr = [[NSString alloc]initWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil];
//以回车换行分割字符串
NSArray *aryStr = [dataStr componentsSeparatedByString:@"\r\n”];
//将字符串str写入到文件中
[str writeToFile:file2 atomically:YES];
网友评论