comparison of two strings fails
问题 I make a comparison of two strings which are obviously identical. Unfortunately my if clause doesn´t work as expected: NSLog(@"%@ == %@ ?",strippedString1,strippedString2); if (strippedString1 == strippedString2) { [_newBuild setTextColor: [NSColor greenColor] ]; [_OldBuild setTextColor: [NSColor greenColor] ]; } This is my NSLog output: Build: 2A12-046 == Build: 2A12 Even a byte by byte comparison says both strings are identical: Any clues ? 回答1: With == you are comparing pointer address, to