例1:
NSString *string = @"one";
NSString *stringTwo= @"two";
BOOL isResult = [string compare:stringTwo];
NSLog(@"=========%d",isResult);
0相等,-1不相等
例2:
字元串相等用方法isEqualToString
if([string isEqualToString:stringTwo])
{
//相等
}
例1:
NSString *string = @"one";
NSString *stringTwo= @"two";
BOOL isResult = [string compare:stringTwo];
NSLog(@"=========%d",isResult);
0相等,-1不相等
例2:
字元串相等用方法isEqualToString
if([string isEqualToString:stringTwo])
{
//相等
}