+ (BOOL) validateTextField: (UITextField*)textField
{
if(!textField){
return NO;
}
textField.text = [textField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if ([textField.text isEqualToString:@""]) {
return NO;
}
return YES;
}
+ (BOOL) validateString: (NSString*)string
{
if(!string)
{
return NO;
}
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if([string isEqualToString:@""] || [string isEqual:[NSNull null]] || string == nil || [string length]==0)
{
return NO;
}
return YES;
}
No comments:
Post a Comment