Programming Reference/Librarys
Question & Answer
Q&A is closed
- (BOOL)isEqualToString:(NSString *)aString;
Returns a Boolean value that indicates whether a given string is equal to the receiver using an literal Unicode-based comparison.
NSString *myString1=@"Hello World"; NSString *myString2=@"Hello World"; if([myString1 isEqualToString:myString2]){ NSLog(@"similar"); } else{ NSLog(@"dissimilar"); } // it returns a boolean, a special int NSLog(@"%i", [myString1 isEqualToString:myString2]);
2012-04-15 12:47:04.266 FoundationNSString[719:403] similar 2012-04-15 12:47:04.269 FoundationNSString[719:403] 1