https://github.com/adrg/postcode
Small Golang package for validating postal codes
https://github.com/adrg/postcode
go golang matching postal-codes postcode validation zip zipcode
Last synced: 5 months ago
JSON representation
Small Golang package for validating postal codes
- Host: GitHub
- URL: https://github.com/adrg/postcode
- Owner: adrg
- License: mit
- Created: 2016-07-12T13:05:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T16:09:45.000Z (about 1 year ago)
- Last Synced: 2024-06-18T20:08:16.874Z (11 months ago)
- Topics: go, golang, matching, postal-codes, postcode, validation, zip, zipcode
- Language: Go
- Homepage: https://pkg.go.dev/github.com/adrg/postcode
- Size: 30.3 KB
- Stars: 13
- Watchers: 3
- Forks: 13
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
postcode
========
[](https://github.com/adrg/postcode/actions?query=workflow%3ACI)
[](https://codecov.io/gh/adrg/postcode)
[](https://pkg.go.dev/github.com/adrg/postcode)
[](https://opensource.org/licenses/MIT)
[](https://goreportcard.com/report/github.com/adrg/postcode)
[](https://github.com/adrg/postcode/issues)
[](https://ko-fi.com/T6T72WATK)Small package for validating postal codes. While the validation process does
not guarantee that the postcode actually exists, it does guarantee that the
format of the provided input is valid.The reason for creating this package is that there is no good regular
expression for validating postal codes, and even if it existed, it would have
been huge and inefficient.Full documentation can be found at: https://pkg.go.dev/github.com/adrg/postcode.
## Installation
go get github.com/adrg/postcode## Usage
```go
package mainimport (
"github.com/adrg/postcode"
)func main() {
if err := postcode.Validate("10007"); err != nil {
// Treat error.
}
}
```## References
For more information see
* [Wikipedia's List of postal codes](https://en.wikipedia.org/wiki/List_of_postal_codes)
* [Wikipedia's List of country codes](https://en.wikipedia.org/wiki/ISO_3166-1)## Contributing
Contributions in the form of pull requests, issues or just general feedback,
are always welcome.
See [CONTRIBUTING.MD](CONTRIBUTING.md).## License
Copyright (c) 2016 Adrian-George Bostan.This project is licensed under the [MIT license](https://opensource.org/licenses/MIT).
See [LICENSE](LICENSE) for more details.