I'm working on a small iphone project and i would need to check if the userName entered only contains alphanumerical characters? (A-Z, a-z, 0-9. How would i go about checking it?
(A-Z, a-z, 0-9
If you don't want to bring in a regex library for this one task...
NSString *str = @"aA09"; NSCharacterSet *alphaSet = [NSCharacterSet alphanumericCharacterSet]; BOOL valid = [[str stringByTrimmingCharactersInSet:alphaSet] isEqualToString:@""];
2.1m questions
2.1m answers
60 comments
57.0k users