标签: objective-c
如果它们不相等,我如何比较两个字符串?
答案 0 :(得分:43)
只需使用isEqualToString并放入!在整个表达之前,像这样:
if (![self.passwordField.text isEqualToString: self.confirmPasswordField.text])
答案 1 :(得分:2)
使用NSString比较方法(或其中一个更详细的变体)
https://developer.apple.com/documentation/foundation/nsstring/1414082-compare
https://developer.apple.com/documentation/foundation/nsstring/1410893-compare