• 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 newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString newbie question


  • Subject: Re: NSString newbie question
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Wed, 20 Aug 2003 14:17:18 +0100

On Wednesday, August 20, 2003, at 01:44 pm, John Fowler wrote:

I am learning about cocoa and objective C. I am creating a project to
parse a block of text into lines.

My question about the following is: Why does the separation string
"\n" not work? What general character or other workaround can I use to
divide text into lines?

Your problem is almost certainly related to the fact that different systems use different conventions to identify the ends of lines in a file; in particular, the DOS/Windows world uses CR-LF ("\r\n"), the Mac and Amiga use CR ('\r') and the Unix (including Mac OS X) world uses LF ('\n').

If I were you, I'd use LF as the line separator in any new files you write, but you're going to have to understand any combination of CR and LF as a line break (you can't even rely on DOS/Windows programs using CR-LF, because despite the fact that that is the standard on their systems, there are a lot of incompetent programmers out there :-(). Also, if you're planning on loading a text file, editing it and then saving it again, make sure you use the same line ending convention that was used in the original text file.

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSString newbie question (From: John Fowler <email@hidden>)

  • Prev by Date: Swith spell checking on / off
  • Next by Date: Re: Delegate methods[SOLVED]
  • Previous by thread: NSString newbie question
  • Next by thread: Re: NSString newbie question
  • Index(es):
    • Date
    • Thread