ZipCodeValidator

public class ZipCodeValidator

A class to that the SDK uses to check for valid zip codes numbers

  • The regex value that is used to check for zip validity

    Declaration

    Swift

    public static let zipCodeValidationRegex: String
  • A class function that tests whether or not a zip code is valid. Will check

    1. if 5 digits or 9 digits (with a hyphen)
    2. The first 5 digits must be between “00501” and “99999”, inclusive
    3. For 5+4 digit zip codes, there must be a hyphen after the first 5 digits. e.g. 90210-1234

Note

A convenience String method .isValidZipCode() is also available

Declaration

Swift

public static func isValid(zipCode: String) -> Bool