NSString -componentsSeparatedByString: line break
NSString -componentsSeparatedByString: line break
- Subject: NSString -componentsSeparatedByString: line break
- From: Chase Meadors <email@hidden>
- Date: Sun, 26 Jul 2009 20:57:44 -0500
Say I have a string that looks like this
----
Hello. How are you?
This is the second line.
Fourth line.
----
I'm trying to get each line of the reciever by calling
[string componentsSeparatedByString:@"\n"];
This works fine, but assuming the string is actually laid out like this:
Hello. How are you?\nThis is the second line.\n\nFourth line.
The array contains
@"Hello. How are you?"
@"This is the second line."
@"" (???)
@"Fourth line."
The third line is what I'm having problems with. I would think it
would simply be an empty string @"". But,
Both of these:
[stringInQuestion isEqualToString:@""]; //outputs false
[stringInQuestion isEqualToString:@" "]; //also outputs false
output false. Even more puzzling, this
[stringInQuestion length] //outputs 1
outputs 1.
If the length of this mystery string is 1 and it's not a space, what
is it???
Any help appreciated!
_______________________________________________
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