componentsSeparatedByString and eol/lf
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