{"id":15412239,"url":"https://github.com/robthree/licenseplatevalidator","last_synced_at":"2025-03-01T19:30:49.871Z","repository":{"id":69245844,"uuid":"177862341","full_name":"RobThree/LicenseplateValidator","owner":"RobThree","description":"Fun little brain teaser turned into a small library","archived":false,"fork":false,"pushed_at":"2022-01-18T15:13:47.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T12:17:47.181Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":false,"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/RobThree.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-26T20:17:57.000Z","updated_at":"2022-01-18T15:04:45.000Z","dependencies_parsed_at":"2023-09-15T10:45:16.210Z","dependency_job_id":null,"html_url":"https://github.com/RobThree/LicenseplateValidator","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.11764705882352944","last_synced_commit":"98a78b18390b69b3c30b97a867ff9b8f42e8ff4b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobThree%2FLicenseplateValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobThree%2FLicenseplateValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobThree%2FLicenseplateValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobThree%2FLicenseplateValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobThree","download_url":"https://codeload.github.com/RobThree/LicenseplateValidator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241414509,"owners_count":19959227,"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","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":"2024-10-01T16:51:56.278Z","updated_at":"2025-03-01T19:30:49.861Z","avatar_url":"https://github.com/RobThree.png","language":"C#","readme":"# \u003cimg src=\"https://github.com/RobThree/LicenseplateValidator/blob/master/LicenseplateValidator/logo.png?raw=true\" width=\"48\" height=\"48\"\u003e LicenseplateValidator\nFun little brain teaser turned into a small library\n\n## Main methods:\n\n````c#\nvar lpv = new LicensePlateValidator(); // By default only knows about dutch license plate formats (\"sidecodes\")\n\nlpv.IsValidPlate(\"AB-12-CD\", \"NL\");  // Returns true\nlpv.FormatPlate(\"AB12CD\", \"NL\");     // Returns \"AB-12-CD\"\nlpv.FindSideCode(\"AB12CD\", \"NL\");    // Returns \"XX-99-XX\"\n````\n\nMost methods have a `ignoreDashes` argument; when true, dashes in the input are ignored. When false, dashes should be in the correct place.\n\n````c#\ntarget.IsValidPlate(\"AB12CD\", \"NL\", ignoreDashes: false);    // Returns false\ntarget.IsValidPlate(\"AB-12-CD\", \"NL\", ignoreDashes: false);  // Returns true\n\ntarget.IsValidPlate(\"AB12CD\", \"NL\", ignoreDashes: true);     // Returns true\ntarget.IsValidPlate(\"AB-12-CD\", \"NL\", ignoreDashes: true);   // Returns true\n````\n\nMost methods will throw on errors; there are `Try...` methods that will not throw on common errors (unless documented).\n\n## Other countries / [sidecodes](https://nl.wikipedia.org/wiki/Nederlands_kenteken#Sidecodes):\n\nThe `LicensePlateValidator` supports other countries. All you need to do is pass in the allowed sidecodes. These are codes like `XX-99-XX` which describe where digits (`9`), letters (`X`), digit _or_ letter (`?`) and dashes (`-`) should go in a plate. You can specify these, along with the country codes, in the constructor:\n\n````c#\nvar lpv = new LicenseplateValidator(new Dictionary\u003cstring, string[]\u003e(StringComparer.OrdinalIgnoreCase)\n{\n    { \"XX\", new[] { \"XX-99-XX\", \"X9-9X-X9\", \"99-X-99X\" } },\n    { \"YY\", new[] { \"99-XX-99\", \"XXX-999\" } }\n});\n````\nThe above initializes a new `LicenseplateValidator` with two fictional countries (`\"XX\"` and `\"YY\"`) with the sidecodes for each country. Note that because we use an overload of the dictionary that makes the key comparer case-insensitive you can pass `\"XX\"`, `\"Xx\"`, `\"xX\"` or `\"xx\"` as countrycode to all methods and this will work fine. If you don't want this behaviour then simply use the parameterless dictionary constructor or pass any other `IDictionary\u003cstring, string[]\u003e` that implements the desired key comparison. Also note that you don't *HAVE* to stick with country codes like \"NL\", \"XX\" etc. You can use whatever key you like.\n\n## About actual validation\n\nThis project / library was born out of a little brainteaser that got a little out of hand. However; that doesn't mean in any way that this library is 100% correct. In fact, it doesn't even make any _attempt_ to be correct. For example, ANY letter will be allowed where some sidecodes don't allow certain letters (like [the letter `C`](https://nl.wikipedia.org/wiki/Nederlands_kenteken#Sidecode_1) which isn't valid in Sidecode 1). Also some letters/digits are only allowed in certain places. All these minor details have _not_ been added to this library. This is a quick'n'dirty fun little project that works fine for most purposes. If you want all the nitty gritty details supported or implemented then I suggest you look elsewhere (or make a pull request 😉). Methods like `IsValid()` therefore only return a 'minimal effort' result, an 'estimate' of whether a plate _could_ be valid.\n\n\u003chr\u003e\n\n[Icon](https://www.flaticon.com/free-icon/license-plate_310662) made by [Freepik](http://www.flaticon.com/authors/freepik) from [www.flaticon.com](http://www.flaticon.com) is licensed by [CC 3.0](http://creativecommons.org/licenses/by/3.0/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobthree%2Flicenseplatevalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobthree%2Flicenseplatevalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobthree%2Flicenseplatevalidator/lists"}