Zip Codes

The Protector stage library includes the following category functions for zip codes. You can use these functions only in stages included in the Protector stage library.

US_ZIP_CODE:stateGroup()
Returns the state group of United States zip codes. The state group is the first digit of the zip code.
Return type: String.
For example, when evaluating 94105-2376, this function returns 9.
US_ZIP_CODE:region()
Returns the region, or sectional center facility (SCF), numbers of United States zip codes. The region group is the second and third digits of a zip code.
Return type: String.
For example, when evaluating 94105-2376, this function returns 41.
US_ZIP_CODE:cityArea()
Returns the city or town area numbers of United States zip codes. The city or town area is the fourth and fifth digits of a zip code.
Return type: String.
For example, when evaluating 94105-2376, this function returns 05.
US_ZIP_CODE:specificLocation()
Returns the specific geographic location, which is the last four digits of a 9 digit United States zip code. The specific geographic location is also known as the +4 part of a zip code.
When a zip code does not include the specific geographic location, this function returns an empty string.
Return type: String.
For example, when evaluating 94105-2376, this function returns 2376.
US_ZIP_CODE:specificLocationOrDefault(<default>)
Returns the specific geographic location, which is the last four digits of a 9 digit United States zip code. The specific geographic location is also known as the +4 part of a zip code. When a zip code does not include the specific geographic location, this function returns the user-defined default value.
Uses the following argument:
  • default - The default value to use when the zip code is 5 digits instead of 9 digits.
Return type: String.
For example, ${US_ZIP_CODE:specificLocationOrDefault('no +4')} returns no +4 each time the function evaluates a 5 digit zip code.
US_ZIP_CODE:std()
Returns zip codes in one of the following standard formats:
<five digit zip>
<five digit zip>-<specific location>
Return type: String.
For example, when evaluating 32222, this function returns 32222. When evaluating 322224444, this function returns 32222-4444.