On Aug 21, 2008, at 9:44 PM, Keith Spiller wrote:
Hi,
RE: Restore Leading Zeros in Zip Codes
Does anyone happen to have a script that will restore the leading
zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4
codes? Any suggestions?
Thanks,
Keith
Of course as other
At 7:47 PM +0100 8/24/08, ioannes wrote:
George Bernard Shaw, an Irishman.
tedd wrote:
As Churchill once said "We are two peoples separated by a common language."
And so did Oscar Wilde, Mark Twain, and Patton -- Google it and
you'll find that everyone said it.
Cheers,
tedd
--
--
George Bernard Shaw, an Irishman.
tedd wrote:
At 11:13 PM +0100 8/22/08, Ashley Sheridan wrote:
Not to mention, but of the two major English speaking countries, both
America and England have different address standards. All too often
an American site seems to think that a postcode is the sam
At 11:13 PM +0100 8/22/08, Ashley Sheridan wrote:
Not to mention, but of the two major English speaking countries,
both America and England have different address standards. All too
often an American site seems to think that a postcode is the same
thing as a zip code, and then rejects it in a
On Fri, 2008-08-22 at 17:16 -0400, tedd wrote:
> At 12:35 PM -0400 8/22/08, Dan Joseph wrote:
> > > tedd wrote:
> >
> > >> Why take them out in the first place? Keep the zip code as a string.
> > After
> > >> all, not all countries use just numbers.
> >
> >
> >From a recent experience, you sho
At 12:35 PM -0400 8/22/08, Dan Joseph wrote:
> tedd wrote:
>> Why take them out in the first place? Keep the zip code as a string. After
>> all, not all countries use just numbers.
From a recent experience, you should all listen to Tedd's advice. I
inhereited an application when I came to
On Fri, Aug 22, 2008 at 12:28 PM, Afan Pasalic <[EMAIL PROTECTED]> wrote:
>
>
> tedd wrote:
>>
>> At 8:44 PM -0600 8/21/08, Keith Spiller wrote:
>>>
>>> Hi,
>>>
>>> RE: Restore Leading Zeros in Zip Codes
>>>
>>> Does anyone happen to have a script that will restore the leading zeros
>>> in a mixed
On Fri, Aug 22, 2008 at 12:28 PM, Afan Pasalic <[EMAIL PROTECTED]> wrote:
>
>
> tedd wrote:
>
>> At 8:44 PM -0600 8/21/08, Keith Spiller wrote:
>>
>>> Hi,
>>>
>>> RE: Restore Leading Zeros in Zip Codes
>>>
>>> Does anyone happen to have a script that will restore the leading zeros
>>> in a mixed
tedd wrote:
At 8:44 PM -0600 8/21/08, Keith Spiller wrote:
Hi,
RE: Restore Leading Zeros in Zip Codes
Does anyone happen to have a script that will restore the leading
zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4
codes? Any suggestions?
Thanks,
Keith
Keith:
Why
At 8:44 PM -0600 8/21/08, Keith Spiller wrote:
Hi,
RE: Restore Leading Zeros in Zip Codes
Does anyone happen to have a script that will restore the leading
zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4
codes? Any suggestions?
Thanks,
Keith
Keith:
Why take them out
ren Vail'; 'Keith Spiller'; php-general@lists.php.net
> Subject: RE: [PHP] Restore Leading Zeros in Zip Codes
>
> Dave brought up something I forgot, what if the "-" is
> already in the sip code;
>
> Modify the code as follows;
>
> I
$zipcode = substr($zipcode,0,5)."-".substr(zipcode,5);
}
> -Original Message-
> From: Warren Vail [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 21, 2008 8:08 PM
> To: 'Keith Spiller'; php-general@lists.php.net
> Subject: RE: [PHP] Restore Leading
I'd try something like;
If(strlen($zipcode) <= 5) $zipcode = sprintf("%05d",$zipcode);
Else {
$zipcode = sprintf("%09d",$zipcode);
$zipcode = substr($zipcode,0,5)."-".substr(zipcode,5);
}
This isn't real elegant, but it should do the trick. You may notice that
the 10 character zip code i
That's actually not going to work if there's more than 1 zero missing.
This is better.
if (strlen($zip) < 5)
$zip = sprintf('%05d',$zip);
else if (strlen($zip) < 10)
{
$zipArray = explode('-', $zip);
$zip = sprintf('%05d',$zipArray[0]);
$zip .= "-" . $zipArray[1];
}
if (strlen($zip) == 4 || strlen($zip) == 9)
$zip = "0$zip";
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Keith Spiller wrote:
> Hi,
>
> RE: Restore Leading Zeros in Zip Codes
>
> Does anyone happen to have a script that will restore the leading zeros
15 matches
Mail list logo