String comparison newbie question
String comparison newbie question
- Subject: String comparison newbie question
- From: Carl Johan Foss <email@hidden>
- Date: Sat, 18 Nov 2006 10:29:48 +0100
Hi,
I am trying to search a string to find a word in a string. I am using
the comparison method but for some reason it does not work.
Can anybody please let me know why this does not work. The BOOL is
always true here and I was obviously expecting it to be false since
"xx" does not exist in the string.
Maybe the only way here is to use NSScanner? Thanks in advance.
NSString *sentence = @"Application Err: Could not be delivered";
NSString *scan = @"xx";
BOOL res = [sentence compare:scan options:NSCaseInsensitiveSearch];
if (res){
NSLog(@"found");
}
else {
NSLog(@"not found");
}
_______________________________________________
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