+(BOOL)isHaveEmptyString:(NSString *)str{
NSRange range = [str rangeOfString:@" "];
if (range.location != NSNotFound) {
return YES;
}
else {
return NO;
}
}
+(BOOL)isValidateIpAddress:(NSString *)ip{
NSString *emailRegexp = @"(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|[1-9])\\.(25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d{2}|\\d)\\.(25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d{2}|\\d)\\.(25[0-5]|2[0-4]\\d|1\\d{1,2}|\\d{2}|\\d)";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES%@",emailRegexp];
return [emailTest evaluateWithObject:ip];
}
+(BOOL)isValidateUserpassword:(NSString *)password{
NSString *passwordRegexp = @"[\\d*[a-z]*[A-Z]*[{\\[(<~!@#$%^&*()_+=-`|\"?,./;'\\>)\\]}]*]*";
NSPredicate *PasswordTest = [NSPredicate predicateWithFormat:@"SELF MATCHES%@",passwordRegexp];
return [PasswordTest evaluateWithObject:password];
}
- 判断用户名格式是否正确(目前校验规则是大小写字符+数字+'@'特殊符号, 其他特殊符号全部过滤掉)
+(BOOL)isValidateUsername:(NSString *)name{
NSString *userRegexp = @"^[A-Za-z0-9@]{2,18}+$";
NSPredicate *userTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",userRegexp];
return [userTest evaluateWithObject:name];
}
+(BOOL)isValidateEmail:(NSString *)email{
NSString *userRegexp = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; //邮箱格式
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",userRegexp];
return [emailTest evaluateWithObject:email];
}
}
- (BOOL)prefersStatusBarHidden {
returnYES;
}
网友评论