Reputation: 6758
I have a text field that contains an http address. A valid input should be the http:// prefix plus a valid IP address.
I would like to enhance my text field in order to consider valid all strings that have a case insensitive "http" prefix.
For example hTtP://130.14.15.15
is acceptable.
Upvotes: 0
Views: 53
Reputation: 25144
Instead of testing like if ([aString hasPrefix:@"http://"])
you could test the lowercase version of the string:
if ([aString.lowercaseString hasPrefix:@"http://"])
Upvotes: 2