12345678910111213141516171819202122232425 |
- //
- // NSString+verify.m
- // RuiYuRealEstate
- //
- // Created by coderYK on 2018/9/5.
- // Copyright © 2018年 coderYK. All rights reserved.
- //
- #import "NSString+verify.h"
- @implementation NSString (verify)
- - (BOOL)isPhoneNum {
- NSString *regex = @"^1[0-9]{10}$";//11位手机号码
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
- return [pred evaluateWithObject:self];
- }
- - (BOOL)isPwd {
- NSString *regex = @"^(?![a-zA-Z]+$)(?!\\d+$)(?![^\\da-zA-Z\\s]+$).{8,20}$";
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
- return [predicate evaluateWithObject:self];
- }
- @end
|