12345678910111213141516171819202122232425 |
- //
- // NSString+JZExtension.m
- // JIZHANG
- //
- // Created by jikaipeng on 2017/10/26.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "NSString+JZExtension.h"
- @implementation NSString (JZExtension)
- +(BOOL)judgePassWordLegal:(NSString *)pass{
- BOOL result = false;
- if ([pass length] >= 6){
- // 判断长度大于6位后再接着判断是否同时包含数字和字符
- NSString * regex = @"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$";
- NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
- result = [pred evaluateWithObject:pass];
- }
- return result;
- }
- @end
|