{"id":15458603,"url":"https://github.com/nisrulz/validatetor","last_synced_at":"2025-10-26T04:39:00.996Z","repository":{"id":147265261,"uuid":"112947883","full_name":"nisrulz/validatetor","owner":"nisrulz","description":"Android library for fast and simple string validation","archived":false,"fork":false,"pushed_at":"2020-06-13T22:56:26.000Z","size":156,"stargazers_count":141,"open_issues_count":4,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-14T10:24:46.132Z","etag":null,"topics":["android","creditcard-validator","email-validation","library","string","validatetor","validation"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nisrulz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"nisrulz","ko_fi":"nisrulz","buy_me_a_coffee":"nisrulz","custom":["https://revolut.me/nisrulz","https://www.paypal.me/nisrulz/5eur"]}},"created_at":"2017-12-03T17:23:14.000Z","updated_at":"2025-01-08T08:14:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"66524c0f-a81d-46bf-a80e-91a6eaa2da62","html_url":"https://github.com/nisrulz/validatetor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nisrulz/validatetor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nisrulz%2Fvalidatetor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nisrulz%2Fvalidatetor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nisrulz%2Fvalidatetor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nisrulz%2Fvalidatetor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nisrulz","download_url":"https://codeload.github.com/nisrulz/validatetor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nisrulz%2Fvalidatetor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281059638,"owners_count":26437056,"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-26T02:00:06.575Z","response_time":61,"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":["android","creditcard-validator","email-validation","library","string","validatetor","validation"],"created_at":"2024-10-01T23:01:22.743Z","updated_at":"2025-10-26T04:39:00.983Z","avatar_url":"https://github.com/nisrulz.png","language":"Java","funding_links":["https://github.com/sponsors/nisrulz","https://ko-fi.com/nisrulz","https://buymeacoffee.com/nisrulz","https://revolut.me/nisrulz","https://www.paypal.me/nisrulz/5eur","https://www.paypal.me/nisrulz/5usd"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"img/github_banner.png\"/\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003e\u003ca href=\"https://twitter.com/intent/tweet?text=Checkout%20ValidateTor%3A%20Android%20library%20for%20fast%20and%20simple%20string%20validation%F0%9F%98%8E%26via%3Dnisrulz%26hashtags%3DAndroidDev%2Candroid%2Clibrary%2COpenSource\"\u003e\n        \u003cimg src=\"https://img.shields.io/twitter/url/http/shields.io.svg?style=social\"/\u003e\n    \u003c/a\u003e\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cstrong\u003eAndroid library for fast and simple string validation.\u003c/strong\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003c!-- Bintray --\u003e\n    \u003ca href=\"https://bintray.com/nisrulz/maven/validatetor/_latestVersion\"\u003e\n        \u003cimg src=\"https://api.bintray.com/packages/nisrulz/maven/validatetor/images/download.svg\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- API --\u003e\n    \u003ca href=\"https://android-arsenal.com/api?level=14\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/API-14%2B-orange.svg?style=flat\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- GitHub stars --\u003e\n    \u003ca href=\"https://github.com/nisrulz/validatetor\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/stars/nisrulz/validatetor.svg?style=social\u0026label=Star\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- GitHub forks --\u003e\n    \u003ca href=\"https://github.com/nisrulz/validatetor/fork\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/forks/nisrulz/validatetor.svg?style=social\u0026label=Fork\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- GitHub watchers --\u003e\n    \u003ca href=\"https://github.com/nisrulz/validatetor\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/watchers/nisrulz/validatetor.svg?style=social\u0026label=Watch\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- Say Thanks! --\u003e\n    \u003ca href=\"https://saythanks.io/to/nisrulz\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.paypal.me/nisrulz/5usd\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026amp;style=flat\"\u003e\n    \u003c/a\u003e\n    \u003cbr/\u003e\n     \u003c!-- GitHub followers --\u003e\n    \u003ca href=\"https://github.com/nisrulz/validatetor\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/followers/nisrulz.svg?style=social\u0026label=Follow%20@nisrulz\"/\u003e\n    \u003c/a\u003e\n    \u003c!-- Twitter Follow --\u003e\n    \u003ca href=\"https://twitter.com/nisrulz\"\u003e\n        \u003cimg src=\"https://img.shields.io/twitter/follow/nisrulz.svg?style=social\"/\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ❤︎ by\n  \u003ca href=\"https://twitter.com/nisrulz\"\u003eNishant Srivastava\u003c/a\u003e and\n  \u003ca href=\"https://github.com/nisrulz/validatetor/graphs/contributors\"\u003e\n    contributors\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n# Including in your project\nValidateTor is available in Jcenter, so getting it as simple as adding it as a dependency\n```gradle\nimplementation 'com.github.nisrulz:validatetor:{latest version}'\n```\nwhere `{latest version}` corresponds to published version in [ ![Download](https://api.bintray.com/packages/nisrulz/maven/validatetor/images/download.svg) ](https://bintray.com/nisrulz/maven/validatetor/_latestVersion)\n\n# Usage\n\n1. Init ValidateTor\n\n    \u003e **_Java_**\n    ```java\n    ValidateTor validateTor = new ValidateTor();\n    ```\n    \u003e **_Kotlin_**\n    ```kotlin\n    var validateTor = ValidateTor();\n    ```\n1. Validate string against the type of validation method from ValidateTor\n\n    ```java\n    // i.e To validate a password string\n    EditText edt_password = findViewById(R.id.edt_password);\n    String str = edt_password.getText().toString();\n\n    // Check if password field is empty\n    if (validateTor.isEmpty(str)) {\n      edt_password.setError(\"Field is empty!\");\n    }\n\n    // Check password string to be of minimum length of 8 characters and should have\n    // atleast 1 digit, 1 upppercase letter and 1 special character\n    if (validateTor.isAtleastLength(str, 8)\n        \u0026\u0026 validateTor.hasAtleastOneDigit(str)\n        \u0026\u0026 validateTor.hasAtleastOneUppercaseCharacter(str)\n        \u0026\u0026 validateTor.hasAtleastOneSpecialCharacter(str)) {\n\n        // Valid Password\n\n    } else {\n       // Invalid Password, handle in ui\n        edt_password.setError(\"Password needs to be of minimum length of 8 characters and should have \" +\n          \"atleast 1 digit, 1 upppercase letter and 1 special character \");\n    }\n    ```\n\n    ... other possible validations are as below:\n\n    |Method Name                                    |Description                                                                              |Return Type\n    |-----------------------------------------------|-----------------------------------------------------------------------------------------|-------------\n    |`containsSubstring(String str, String seed)`   |Check if the string contains the seed                                                    | boolean\n    |`isAlpha(String str)`                          |Check if the string contains only letters                                                | boolean\n    |`isAlphanumeric(String str)`                   |Check if the string contains only letters and numbers                                    | boolean\n    |`isBoolean(String str)`                        |Check if a string is a boolean                                                           | boolean\n    |`isIPAddress(String str)`                      |Check if the string is a ip address                                                      | boolean\n    |`isEmail(String str)`                          |Check if the string is a email address                                                   | boolean\n    |`isPhoneNumber(String str)`                    |Check if the string is a US phone number                                                 | boolean\n    |`isEmpty(String str)`                          |Check if the string has a length of zero                                                 | boolean\n    |`isBase64(String str)`                         |Check if a string is base64 encoded                                                      | boolean\n    |`isDecimal(String str)`                        |Check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc | boolean\n    |`isAtleastLength(String str, int len)`         |Check if the string is of atleast the specified length                                   | boolean\n    |`isAtMostLength(String str, int len)`          |Check if the string is of atmost the specified length                                    | boolean\n    |`isLowercase(String str)`                      |Check if the string is all lowercase                                                     | boolean\n    |`isUppercase(String str)`                      |Check if the string is all uppercase                                                     | boolean\n    |`isValidMD5(String str)`                       |Check if the string is a valid MD5 hash                                                  | boolean\n    |`isNumeric(String str)`                        |Check if the string contains only numbers                                                | boolean\n    |`isMACAddress(String str)`                     |Check if the string is a MAC address                                                     | boolean\n    |`isJSON(String str)`                           |Check if the string is valid JSON                                                        | boolean\n    |`isInteger(String str)`                        |Check if the string is an integer                                                        | boolean\n    |`isIn(String str, String[] values)`            |Check if the string is present in an array of allowed values                             | boolean\n    |`isHexadecimal(String str)`                    |Check if the string is a hexadecimal number                                              | boolean\n    |`isPinCode(String str)`                        |Check if the string is a pincode                                                         | boolean\n    |`isHexColor(String str)`                       |Check if the string is a hexadecimal color                                               | boolean\n    |`hasAtleastOneDigit(String str)`               |Check if the string has atleast one digit                                                | boolean\n    |`hasAtleastOneLetter(String str)`              |Check if the string has atleast one letter                                               | boolean\n    |`hasAtleastOneLowercaseCharacter(String str)`  |Check if the string has atleast one lowercase character                                  | boolean\n    |`hasAtleastOneUppercaseCharacter(String str)`  |Check if the string has atleast one uppercase character                                  | boolean\n    |`hasAtleastOneSpecialCharacter(String str)`    |Check if the string has atleast one special character                                    | boolean\n    |`validateCreditCard(String str)`               |Check if the string is a valid credit card number                                        | boolean\n    |`getCreditCardInfo(String str)`                |Get CreditCard information from string                                                   | CardInformation\n\n\n# Extending ValidateTor\n\nIf you wish to extend ValidateTor, use the `RegexMatcher` class. Create your own regex matchers by passing in a valid regex string to `validate()` or `find()`\n\n|Method Name                                 |Description                               |Return Type\n|--------------------------------------------|------------------------------------------|-------------\n|`validate(String dataStr, String regex)`    |Validate string against a regex           | boolean\n|`validate(String dataStr, Pattern pattern)` |Validate string against a pattern         | boolean\n|`find(String dataStr, String regex)`        |Find in string against a regex            | boolean\n|`find(String dataStr, Pattern pattern)`     |Find in string against a pattern          | boolean\n\n\n\n## License\nLicensed under the Apache License, Version 2.0, [click here for the full license](/LICENSE.txt).\n\n## Author \u0026 support\nThis project was created by [Nishant Srivastava](https://github.com/nisrulz/nisrulz.github.io#nishant-srivastava) but hopefully developed and maintained by many others. See the [the list of contributors here](https://github.com/nisrulz/validatetor/graphs/contributors).\n\n\u003e If you appreciate my work, consider buying me a cup of :coffee: to keep me recharged :metal:\n\u003e  + [PayPal](https://www.paypal.me/nisrulz/5usd)\n\n\u003e\n\u003e I love using my work and I'm available for contract work. Freelancing helps to maintain and keep [my open source projects](https://github.com/nisrulz/) up to date!\n\n\u003cimg src=\"http://forthebadge.com/images/badges/built-for-android.svg\" /\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnisrulz%2Fvalidatetor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnisrulz%2Fvalidatetor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnisrulz%2Fvalidatetor/lists"}