Re: iPhone: validate a NSString for US zipcode
Re: iPhone: validate a NSString for US zipcode
- Subject: Re: iPhone: validate a NSString for US zipcode
- From: Alastair Houghton <email@hidden>
- Date: Thu, 7 Jan 2010 17:21:06 +0000
On 7 Jan 2010, at 16:11, Eric E. Dolecki wrote:
> I've been googling but haven't seen yet how to best validate a 5-digit
> zipcode for use in the US (without using a webservice).
>
> I have the NSString, I just need to validate it. I know zero RegExp, is
> there a formatter I can use?
It might be better *not* to try to validate it at all. That way you'll have zero work to do to make your application accept data for non-U.S. addresses, some of which (Canada and the United Kingdom being two good examples) use alphanumeric postal codes *with spaces*, or (in some European countries) a five-digit code with an optional alpha prefix indicating country.
Also, if the webservice you are using doesn't support anything other than U.S. zip codes right now, it might gain support later on, so the appropriate place to do any validation is in that webservice.
Just my 2 cents as a non-U.S. citizen...
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden