• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString ambiguities
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString ambiguities


  • Subject: Re: NSString ambiguities
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 30 Jun 2010 15:05:58 -0700

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_______________________________________________

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

References: 
 >NSString ambiguities (From: Ariel Feinerman <email@hidden>)

  • Prev by Date: Re: class_respondsToSelector() in runtime.h?
  • Next by Date: configurePersistentStoreCoordinatorForURL:ofType: modelConfiguration: storeOptions:error
  • Previous by thread: NSString ambiguities
  • Next by thread: configurePersistentStoreCoordinatorForURL:ofType: modelConfiguration: storeOptions:error
  • Index(es):
    • Date
    • Thread