My problem is that i have a NSString and i have to compare it with two other NSStrings.
How can i compare NSStrings like:
if(a == (b || c))
My resolution for this isn’t fine yet (but works) :
NSString *a = @"myfirststring";
NSString *b = @"mysecondstring";
if([[NSString stringWithFormat:@"%s", MethodThatReturnsChar*] isEqual:a] || [[NSString stringWithFormat:@"%s",MethodThatReturnsChar*] isEqual:b])
{
}
The problem is that i have to call MethodThatReturnsChar* two times, that isn’t necessary, is it?
Exactly, it’s completely superfluous. That’s why the C language has variables… Also, don’t abuse
- [NSString stringWithFormat:]. Furthermore, useisEqualToString:for comparison: