0

I have validated UITextfield to enter numbers only as well as limited to 5 digits. But how can i check whether the entered 5 digit code is a valid US zip code or not? Can someone provide a code/sample app which performs this functionality?

Shaunak
  • 707
  • 1
  • 9
  • 29
  • take a look at this answer http://stackoverflow.com/questions/160550/zip-code-us-postal-code-validation – wattson12 Jan 21 '13 at 09:45

1 Answers1

0

You can look here http://www.populardata.com/zipcode_database.html and can download the list of U.S zip code the data is in CSV format but can be converted easily in to xml then you can include the xml in to your project and compare every time you need to with the xml file through various parsing methods.

spider1983
  • 1,098
  • 1
  • 7
  • 14
  • 1
    I wonder how often this file gets updated. I'd like a combined solution, where you check the zip online, like at https://tools.usps.com/ and fall back to a file/DB, when there is no connection. – ott-- Jan 21 '13 at 10:12
  • @ott-- ya i am also not sure about how often this database gets updated but if you want to implement the functionality without using internet you can go for it./ one can go for your solution too for more flexibility. 1 up for that. – spider1983 Jan 21 '13 at 10:41