Victor John Victor John - 4 months ago 23
Objective-C Question

How can I compare the two special symbols with equality between @"+" and @"+" in iOS?

Accepted a special symbol through UITextField, likes symbol +, I want to compare them with equality. @"+" does not equal @"+". @"+" by UITextField, @"+" by inputing on Xcode.But how can I compare them ? Any help is appreciated!


You can achieve it by NSCharecterSet.

NSString *string = <your string>;

NSString *specialCharacterString = @"++";
NSCharacterSet *specialCharacterSet = [NSCharacterSet

if ([string rangeOfCharacterFromSet:specialCharacterSet].length) {