How to compare 2 string variables
Please tell me how to compare 2 string variables I'm not talking about a string variable and a string (that is already posted on this site)
I have tried this:
if (s isEqualToString: str) {
// ...
}
Here s and ss are two NSMutableStrings that already having values, but this isn't working. I have al开发者_Python百科so tried isEqual but failed again.
Please help
You're missing brackets.
if ([s isEqualToString:ss]) {
// ...
}
You can't just use ==
, because a string with the same content may be stored in different objects.
精彩评论