You can check if( [empName length]==0 || [[empName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0) this will return 1 else 0
NSString *empName;
if ([empName length]==0 || [[empName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length]==0)
{
[[[UIAlertView alloc] initWithTitle:@"Error!" message:@"Can not post blank" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil] show];
}
else
{
//perform your action..
}
0 Comment(s)