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

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


  • Follow-Ups:
    • Re: String comparison newbie question
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Re: Non-square (triangular) views
  • Next by Date: Re: String comparison newbie question
  • Previous by thread: Re: NSMutableArray:arrayWithObjects question
  • Next by thread: Re: String comparison newbie question
  • Index(es):
    • Date
    • Thread