- What is the correct format for ZIP code?
- Should ZIP code be string or integer?
- How is the size of a ZIP code determined?
What is the correct format for ZIP code?
The most complete ZIP Code is a nine-digit number consisting of five digits, a hyphen, and four digits, which the USPS describes by its trademark ZIP+4. The correct format for a numeric ZIP+4 code is five digits, a hyphen, and four digits.
Should ZIP code be string or integer?
ZIP codes should not be stored as integers. If you were going to incorrectly store a ZIP code as an integer, you'd store the value 7601 and then need to know when you display it that you need to add in the leading 0.
How is the size of a ZIP code determined?
ZIP Codes are numbered with the first digit representing a certain group of U.S. states, the second and third digits together representing a region in that group (or perhaps a large city) and the fourth and fifth digits representing a group of delivery addresses within that region.