Victor John Victor John - 1 year ago 77
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!

Answer Source

You can achieve it by NSCharecterSet.

NSString *string = <your string>;

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

if ([string rangeOfCharacterFromSet:specialCharacterSet].length) {                
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download