小编Dav*_*vid的帖子

Objective C stringWithFormat if语句

我对此很新 - 我正在尝试将NSString stringWithFormat与一些文本进行比较.它与stringWithString一起工作正常.我无法弄清楚为什么它不能与stringWithFormat一起使用?非常感谢任何人提供的任何帮助!

    NSString *theQuestion = [NSString stringWithFormat:@"The same thing"];
if (theQuestion == @"The same thing"){
        NSLog(@"stringWithFormat is the same as the given text");
    }else{
NSLog(@"stringWithFormat is NOT the same as the given text");
        NSLog(@"but theQuestion is:\"%@\"", theQuestion);
    }
Run Code Online (Sandbox Code Playgroud)

if-statement objective-c stringwithformat stringwithstring

4
推荐指数
1
解决办法
764
查看次数