I\'ve got a string that needs to be only a-z, 0-9 and _
How do I check if the input is valid? I\'ve tried this but it accepts letter like å,ä,ö,ø etc.
NS
You could loop through the every character in the string and check that it's alphanumeric:
BOOL isMatch = YES; for (int i = 0; i < [string length]; i++) { unichar c = [string characterAtIndex:i]; if (!isalnum(c) && c != '_') { isMatch = NO; break; } } if (isMatch) { // valid } else { // invalid }