Re: NSString ambiguities
Re: NSString ambiguities
- Subject: Re: NSString ambiguities
- From: Ariel Feinerman <email@hidden>
- Date: Thu, 1 Jul 2010 14:02:44 +0300
I wish to get the strings from file, exclude some strings and empty strings
and write them to file, so do you sure these methods are for that? Can you
explain what you suggest by given an example?
I take care of backward compatibility with 10.5 therefore 10.6 blocks is out
.
Thank you.
2010/7/1 Douglas Davidson <email@hidden>
>
> On Jun 30, 2010, at 3:02 PM, Ariel Feinerman wrote:
>
> > 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"?
>
> What's best is enumerateSubstringsInRange:options:usingBlock:. You can use
> NSStringEnumerationByParagraphs to handle all the standard paragraph
> separators. Prior to 10.6, use paragraphRangeForRange: or
> getParagraphStart:end:contentsEnd:forRange: and construct your own loop.
>
> Douglas Davidson
--
best regards
Ariel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden