Skip to main content
Where something is, or which language it speaks. postalCode(country) knows the formats of 72 countries, by their ISO 3166-1 alpha-2 code, and checks nothing when the country is null or unknown, so the rule can follow a country field that may be missing.
Store.kt

Countries and languages

isoCountryCode

isoCountryCode() on String Checks that the string is an ISO 3166-1 alpha-2 country code, such as BR, in uppercase. isoCountryCode

isoCountryCodeAlpha3

isoCountryCodeAlpha3() on String Checks that the string is an ISO 3166-1 alpha-3 country code, such as BRA, in uppercase. isoCountryCodeAlpha3

languageCode

languageCode() on String Checks that the string is an ISO 639-1 language code, such as pt, in lowercase. The withdrawn codes in, iw, ji and mo fail. languageCode

locale

locale() on String Checks that the string is a well-formed IETF BCP 47 language tag, such as pt-BR or zh-Hant-TW. locale

timeZone

timeZone() on String Checks that the string is a time zone id the JVM knows, such as America/Sao_Paulo or UTC. timeZone

Latitude and longitude

latitude

latitude() on Double, Float, BigDecimal, String Checks that the number is a latitude, from -90 to 90. latitude

longitude

longitude() on Double, Float, BigDecimal, String Checks that the number is a longitude, from -180 to 180. longitude

coordinates

coordinates() on String Checks that the string is a latitude from -90 to 90 and a longitude from -180 to 180, separated by a comma, such as -23.5505, -46.6333. coordinates

Postal codes

postalCode

postalCode(country) on String Checks that the string is a postal code of country. When country is null or has no known format, nothing is checked. Codes are known for 72 countries. postalCode The countries postalCode knows: AD, AR, AT, AU, AZ, BA, BD, BE, BG, BR, BY, CA, CH, CN, CO, CZ, DE, DK, DO, DZ, EE, ES, FI, FR, GB, GR, HR, HT, HU, ID, IE, IL, IN, IR, IS, IT, JO, JP, KE, KR, LI, LK, LT, LU, LV, MC, MG, MT, MX, MY, NL, NO, NP, NZ, PK, PL, PR, PT, RO, RU, SA, SE, SG, SI, SK, TH, TN, TW, UA, US, ZA and ZM.