All Projects → FormatterKit → Postalcodevalidator

FormatterKit / Postalcodevalidator

Licence: mit
A validator for postal codes with support for 200+ regions

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Postalcodevalidator

Localize Router
An implementation of routes localisation for Angular
Stars: ✭ 177 (-16.11%)
Mutual labels:  i18n
Universal Translator
💬 i18n Translator for Go/Golang using CLDR data + pluralization rules
Stars: ✭ 195 (-7.58%)
Mutual labels:  i18n
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+1024.64%)
Mutual labels:  i18n
Dayperiodformatter
A formatter for localized day periods (morning, afternoon, night, etc.)
Stars: ✭ 181 (-14.22%)
Mutual labels:  i18n
Nestjs I18n
Add i18n support inside your nestjs project
Stars: ✭ 195 (-7.58%)
Mutual labels:  i18n
Rails Devise Graphql
A Rails 6 boilerplate to create your next Saas product. Preloaded with graphQL, devise, JWT, CanCanCan, RailsAdmin, Rubocop, Rspec, i18n and more.
Stars: ✭ 199 (-5.69%)
Mutual labels:  i18n
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (-16.59%)
Mutual labels:  i18n
Vue Blog
🎉 基于vue全家桶 + element-ui 构建的一个后台管理集成解决方案
Stars: ✭ 208 (-1.42%)
Mutual labels:  i18n
I18next Express Middleware
[deprecated] can be replaced with i18next-http-middleware
Stars: ✭ 195 (-7.58%)
Mutual labels:  i18n
Angular Seed Advanced
Advanced Angular seed project with support for ngrx/store, ngrx/effects, ngx-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
Stars: ✭ 2,279 (+980.09%)
Mutual labels:  i18n
Linguist
Easy multilingual urls and redirection support for the Laravel framework
Stars: ✭ 188 (-10.9%)
Mutual labels:  i18n
Hugo Theme Bootstrap4 Blog
A blogging-centric Bootstrap v4 theme for the Hugo static site generator.
Stars: ✭ 191 (-9.48%)
Mutual labels:  i18n
Vuesion
Vuesion is a boilerplate that helps product teams build faster than ever with fewer headaches and modern best practices across engineering & design.
Stars: ✭ 2,510 (+1089.57%)
Mutual labels:  i18n
Cldr
Elixir implementation of CLDR/ICU
Stars: ✭ 178 (-15.64%)
Mutual labels:  i18n
Glotpress Wp
🌍 🌎 🌏 GlotPress is a WordPress plugin to let you set up your own collaborative, web-based software translation tool.
Stars: ✭ 205 (-2.84%)
Mutual labels:  i18n
Vue Admin Template
Sample Admin Template based on Vuejs & Vuetify.
Stars: ✭ 177 (-16.11%)
Mutual labels:  i18n
Vue Inter
Simple yet powerful 1kB i18n library for Vue.js
Stars: ✭ 198 (-6.16%)
Mutual labels:  i18n
Nuxt Juejin Project
仿掘金web网站,使用服务端渲染。主要技术:nuxt + koa + vuex + axios + element-ui 。
Stars: ✭ 209 (-0.95%)
Mutual labels:  i18n
Weblate
Web based localization tool with tight version control integration.
Stars: ✭ 2,719 (+1188.63%)
Mutual labels:  i18n
Babel Plugin React Intl Auto
i18n for the component age. Auto management react-intl ID.
Stars: ✭ 203 (-3.79%)
Mutual labels:  i18n

PostalCodeValidator

Build Status License Swift Version

A validator for postal codes with support for 200+ regions.

import Foundation
import PostalCodeValidator

if let validator = PostalCodeValidator(locale: .current) { // United States (US)
    validator.validate(postalCode: "95014") // true
    validator.validate(postalCode: "22162-1010") // true

    validator.validate(postalCode: "1234567") // false
    validator.validate(postalCode: "INVALID") // false
}

// 248 regions supported
if let validator = PostalCodeValidator(regionCode: "JP") { // Japan (JP)
    validator.validate(postalCode: "154-0023") // true
    validator.validate(postalCode: "12345") // false
}

Note: Only the region of a locale is used to determine validation rules. To validate the postal code for a particular region, you can construct a locale using an identifier with the "und" language code.

Requirements

  • Swift 4.0+

Installation

Swift Package Manager

Add the PostalCodeValidator package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/FormatterKit/PostalCodeValidator",
        from: "0.1.0"
    ),
  ]
)

Then run the swift build command to build your project.

Known Issues

  • Armed forces in Germany (and likely other countries) use special postal codes, which aren't included in the upstream data source. This will cause validation of these postal codes to fail. (Thanks for pointing this out, @timohetzel)

Additional Details

The CLDR previously maintained a list of postal code formats, but that information was deprecated in v27.

Following the guidance of the twitter-cldr-rb project, PostalCodeValidator sources its information from http://i18napis.appspot.com. The most recent release of this software uses information retrieved from the website on November 27, 2019.

License

MIT

Contact

Mattt (@mattt)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].