Xcode compare string example
Posted by in iPhone XCode February 28, 2011 1 Comment

While develop your iPhone application, if you want to do string comparisons, use isEqualToString.

 

 

 

 

 

Example:

	if ([your_url isEqualToString:@"4 rapid development"]) {
		NSLog(@"true!!!");
	}
	else {
		NSLog(@"Opps, return false!!!");
	}

Note: below is a WRONG WAY in Xcode:

if(your_url == @"4 rapid development")

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at hoan@4rapiddev.com
  • http://websitestat.info Stat

    thanks for sharing. :) love your works.