密码文本字段的顺序验证

Aks*_*ade 0 iphone validation xcode objective-c ios

如何验证顺序值的密码?

例如 - 如果用户在密码中输入1326或"axdf",则它有效.

如果使用输入1234或"abcd"则无效.

小智 9

我想你可以这样做

NSString *list= @"abcdefghijklmnopqrstuvwxyz"; 

NSString *password= @"abz";  // Suppose this is your password

NSRange range = [list rangeOfString:password options:NSCaseInsensitiveSearch];

 if (range.location == NSNotFound) {
    /* Could NOT find password in list, then it is valid */
   } 
 else {
  /* Found the password in the list then it is not valid */
  }
Run Code Online (Sandbox Code Playgroud)

同样,你也可以为数字做这件事