MACSCRPT Archives

March 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Mark J. Reed" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 20 Mar 2009 07:48:52 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (30 lines)
On Fri, Mar 20, 2009 at 6:50 AM, Nigel Garvey
<[log in to unmask]> wrote:
>>    set aZip to ((characters 1 thru 3 of aZip) as text) as integer
>
> Just to be fussy:
>
>  set aZip to aZip div 100

Huh.  I didn't think that div would work if aZip was passed in as a
string.  I sit corrected.  Thanks.

> These overlap! ("MD" is eliminated with "VA".) Similarly with much of the
> stuff below:

See, kids?  This is why code generation is bad.  I built that big
if/then statement out of a list of min/max zipcodes per state.
Obviously that doesn't work in general, and more care is needed to
identify only the continuous ranges.

But even if you get all the first-three-digit ranges right, it still
won't work in all cases, because the first three digits are not enough
in general to uniquely identify a state.  Thirty-eight of those ranges
have ZIP codes in more than one state (e.g.  993xx in both Oregon and
Washington, 376xx in both Tennessee and Virginia, etc).



--
Mark J. Reed <[log in to unmask]>

ATOM RSS1 RSS2