{"id":32316223,"url":"https://github.com/leaderboy/zyvalidator","last_synced_at":"2025-10-23T10:59:05.817Z","repository":{"id":56931360,"uuid":"113735952","full_name":"LeaderBoy/ZYValidator","owner":"LeaderBoy","description":"用于验证 用户名/密码/手机号/邮箱/身份证号码/日期/URL地址/车牌号 的格式","archived":false,"fork":false,"pushed_at":"2018-06-25T08:15:15.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T10:59:05.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeaderBoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-10T08:53:40.000Z","updated_at":"2018-06-25T08:07:46.000Z","dependencies_parsed_at":"2022-08-21T05:50:30.460Z","dependency_job_id":null,"html_url":"https://github.com/LeaderBoy/ZYValidator","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/LeaderBoy/ZYValidator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeaderBoy%2FZYValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeaderBoy%2FZYValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeaderBoy%2FZYValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeaderBoy%2FZYValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeaderBoy","download_url":"https://codeload.github.com/LeaderBoy/ZYValidator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeaderBoy%2FZYValidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280606607,"owners_count":26359387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-23T10:59:04.866Z","updated_at":"2025-10-23T10:59:05.810Z","avatar_url":"https://github.com/LeaderBoy.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZYValidator\n用于验证 用户名/密码/手机号/邮箱/身份证号码/日期/URL地址/车牌号 的格式\n\n#### 安装\n在 podfile 中\n```\npod 'ZYValidator' \n```\n在终端执行\n```\npod install\n```\n\n#### 默认验证的类型\n```\n/**\n 输入的类型\n \n - ZYInputValidatorTypeEmail: 邮箱\n - ZYInputValidatorTypePhone: 手机号\n - ZYInputValidatorTypeUserName: 用户名（数字/字母/汉字)(3-20位)\n - ZYInputValidatorTypePassword: 密码:密码必须由数字、字符、特殊字符三种中的两种组成,密码长度不能少于8个字符.\n - ZYInputValidatorTypeIDCard: 身份证号码\n - ZYInputValidatorTypeCarNumber: 车牌号码\n - ZYInputValidatorTypeDate: 时间\n - ZYInputValidatorTypePostCode: 邮编\n - ZYInputValidatorTypeURL: URL地址\n */\n```\n#### 以验证手机号为例\n``` \nUITextField *number = [[UITextField alloc]initWithValidatorType:ZYInputValidatorTypePhone];\n// 在需要的地方使用\nNSError *error;\nBOOL result = [number validate:\u0026error];\nif (error) {\n    NSLog(@\"%@\",[error localizedDescription]);\n}\n```\n#### 验证密码格式不同的需求\n```\n/**\n 密码的验证类型\n \n - ZYInputPasswordValidatorTypeDefault:\n 1、密码必须由数字、字符、特殊字符三种中的两种组成；\n 2、密码长度不能少于8个字符；\n - ZYInputPasswordValidatorTypeIntensityLow:\n 弱:由纯数字 或者 纯字母 或者 纯特殊符号组成\n - ZYInputPasswordValidatorTypeIntensityMid:\n 中:由字母+数字 或者 字母+特殊字符 或者 数字+特殊字符 组成\n - ZYInputPasswordValidatorTypeIntensityHigh:\n 强:由字母+数字+特殊字符组成\n - ZYInputPasswordValidatorType1:\n 至少一个 大写字母 一个小写字母 一个数字 其他为任意字符 8-20位\n - ZYInputPasswordValidatorType2:\n 字母开头 任意数字 字母 下划线 8-20位  (注:同时不能使用双下划线 例如__)\n - ZYInputPasswordValidatorType3:\n 数字 字母组合 8-20位\n */ZYInput\n```\n##### 使用的方式\n```\nUITextField *password = [[UITextField alloc]initWithPasswordType:ZYInputPasswordValidatorTypeDefault];\n// 在需要的地方使用\nNSError *error;\nBOOL result = [password validate:\u0026error];\nif (error) {\n    NSLog(@\"%@\",[error localizedDescription]);\n}\n```\n\n#### 验证日期格式不同的需求\n```\n/**\n 日期验证\n\n - ZYInputDateValidatorTypeDefault: 2012-12-12\n - ZYInputDateValidatorType1: 2012/12/12\n - ZYInputDateValidatorType2: 12/12/2012\n */\n```\n#### 使用方式\n```\nUITextField *date= [[UITextField alloc]initWithValidatorType:ZYInputValidatorTypeDate];\n// 在需要的地方使用\nBOOL result = [textField validate:\u0026error];\nif (error) {\n    NSLog(@\"%@\",[error localizedDescription]);\n}\n```\n#### 使用更详细的验证\n```\n/**\n 详细的验证\n\n - ZYInputValidatorOptionsIntensityLow: 密码强度低 返回error -1\n - ZYInputValidatorOptionsIntensityMid: 密码强度中 返回error 0\n - ZYInputValidatorOptionsIntensityHigh: 密码强度高 返回error 1\n - ZYInputValidatorOptionsNotAllNumbers: 不能全是数字\n - ZYInputValidatorOptionsNotAllLetters: 不能全是字母\n - ZYInputValidatorOptionsNotAllSymbols: 不能全是特殊字符\n - ZYInputValidatorOptionsNotAllChinese: 不能全是中文\n - ZYInputValidatorOptionsAllNumbers: 必须全是数字\n - ZYInputValidatorOptionsAllLetters: 必须全是字母\n - ZYInputValidatorOptionsAllSymbols: 必须全是特殊字符\n - ZYInputValidatorOptionsAllChinese: 必须全是中文\n - ZYInputValidatorOptionsUppercaseAtLeast: 至少一个大写字母\n - ZYInputValidatorOptionsLowercaseAtLeast: 至少一个小写字母\n - ZYInputValidatorOptionsNumberAtLeast: 至少一个数字\n */\n```\n\n#### 使用方法\n```\n// 比如当你验证密码的时候你需要的是ZYInputPasswordValidatorType1即\n// 至少一个 大写字母 一个小写字母 一个数字 其他为任意字符 8-20位\n\nUITextField *textField = [[UITextField alloc]initWithPasswordType:ZYInputPasswordValidatorTypeDefault];\n\n// 当用户提交的时候 需要提示用户\nNSError *error;\nBOOL result1 = [textField validate:ZYInputValidatorOptionsUppercaseAtLeast error:\u0026error];\nif (error) {\n    NSLog(@\"%@\",[error localizedDescription]);// 至少一个大写字母\n}\n\nBOOL result2 = [textField validate:ZYInputValidatorOptionsLowercaseAtLeast error:\u0026error];\nif (error) {\n    NSLog(@\"%@\",[error localizedDescription]);// 至少一个小写字母\n}\n\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaderboy%2Fzyvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleaderboy%2Fzyvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaderboy%2Fzyvalidator/lists"}