• 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
componentsSeparatedByString and eol/lf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

componentsSeparatedByString and eol/lf


  • Subject: componentsSeparatedByString and eol/lf
  • From: Bert Torfs <email@hidden>
  • Date: Tue, 13 Dec 2005 22:44:35 +0100

I do want to create an array from a standard text file. The records in that file are ended by a \r\n character sequence.
When I use

lineArray = [[rawData componentsSeparatedByString:@"\r\n"]retain];

everything works as expected.
However, I do not want to hard-code eol and lf characters, as I do want to be tied to a particular encoding. But when I try

NSString* string1 = @"\r";
NSString* string2 = @"\n";
NSString* eolSequence = [NSString stringWithFormat:@"%@%@", string1, string2];
lineArray = [[rawData componentsSeparatedByString: eolSequence]retain];

nothing happens.

I do get a warning 'Non Ascii literal in CFString literal" on the stringWithFormat line, which is - I guess - a clue.

Anyone any idea why this does not work?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: componentsSeparatedByString and eol/lf
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: NSPasteBoard setPropertyList:forType
  • Next by Date: Re: componentsSeparatedByString and eol/lf
  • Previous by thread: Re: NSPasteBoard setPropertyList:forType
  • Next by thread: Re: componentsSeparatedByString and eol/lf
  • Index(es):
    • Date
    • Thread