Objective c Cocoa,Obejective-c如何比较SSH和NSString的输出

Objective c Cocoa,Obejective-c如何比较SSH和NSString的输出,objective-c,macos,cocoa,ssh,compare,Objective C,Macos,Cocoa,Ssh,Compare,如何比较2个字符串,当我从SSH输出中得到一个字符串时,代码部分: NSString *response = [session.channel execute:@"date" error:&error]; NSLog(@"Output: %@", response); NSString *day = @"Saturday"; 输出为=星期六 我无法与之相比: if (response == day) NSLog (@"day equals response"); else

如何比较2个字符串,当我从SSH输出中得到一个字符串时,代码部分:

NSString *response = [session.channel execute:@"date" error:&error];
NSLog(@"Output: %@", response);
NSString *day = @"Saturday";
输出为=星期六

我无法与之相比:

if (response == day)
    NSLog (@"day equals response");
else
    NSLog (@"day does not equal response");

if ([response isEqualToString:day])
    NSLog (@"day equals response");
else
    NSLog (@"day does not equal response");

它总是失败,也许我需要转换响应或日期,或者使用不同的东西

尝试删除响应末尾的行:

response = [response stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];