Hi, If we read whole file as a NSString, will be any conversions between \r\n, \r, \n? Then if not, will be -componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet] create empty strings in Win \r\n case? So what is the best: [NSCharacterSet newlineCharacterSet] or [NSCharacterSet characterSetWithCharactersInString: @"\n"] or simply -componentsSeparatedByString: @"\n"?
code: NSString *string = [[NSString alloc] initWithContentsOfFile: name encoding: NSUTF8StringEncoding error: NULL]; NSArray *array = [string componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet]]; [string release]; string = nil; NSMutableString *outString = [NSString new]; for (string in array) { if (![string isEqualToString: @""]) { // ... [outString appendFormat: @"%...@\n", string]; } } [outString writeToFile: outName atomically: NO encoding: NSUTF8StringEncoding error: NULL]; -- best regards Ariel _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com