NSCharacterSet *upperCaseChars = [NSCharacterSet characterSetWithCharactersInSt ring:@" ABCDEFGHIJKLKMNOPQRSTUVWXYZ"];
NSCharacterSet *numbers = [NSCharacterSet characterSetWithCharactersInSt ring:@"0123456789"];
if ([tx1.text rangeOfCharacterFromSet: lowerCaseChars].location == NSNotFound) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"no small"
message:tx1.text
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else if([tx1.text rangeOfCharacterFromSet: upperCaseChars].location == NSNotFound) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"no cap"
message:tx1.text
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else if([tx1.text rangeOfCharacterFromSet: numbers].location == NSNotFound) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"no num"
message:tx1.text
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"yes......"
message:tx1.text
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
No comments:
Post a Comment