Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>iszip() - check that a zip code is in specified state</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     iszip() - check that a zip code is in specified state
  Usage:    <logical> = iszip(<state>,<zipcode>)
  Params:   string <state> - a two digit state code
            string <zipcode> - the zip code to check as a string

  Returns:  .T. if the zip code is in the specified state, .F. if not.

 ---------------------------------- Example ---------------------------------

                 mstate    = space(2)
                 mzip      = space(10)

                 @ 10,0 say "Enter state:" get mstate pict "!!"
                 @ 11,0 say "Enter zip  :" get mzip pict "99999-9999";
                            valid (iszip(mstate,mzip))
                 read

  Note:     This function is based upon the 1988 Postal Service
            zip code directory. It relies on the fact that each
            state has a range of zip codes for it's state. This
            range of zip codes is based upon the first 3 digits
            of the zip code. The 4th and 5th digits are not looked
            at. Therefore, it is not 100% accurate in the sense
            that there may be a zip code 10010, but not a zip
            code 10098. However, since the first 3 digits of the
            2 zip codes fall between 90 and 149 (the code range
            for New York), they will both return .T. for NY even if
            the zip code 10098 is not in the state of New York.

            The first digit of the zip code is a national code
            where groups of states are given a number between 0-9.
            Within each group, smaller regions are defined by the
            2nd and 3rd digits. These are the digits that iszip()
            and state() check. The 4th and 5th digits identify a
            local delivery area. It is these two digits that are
            frequently added to.

            Do not rely on this function solely. Use it only to
            catch 'possible' error zip codes. If the user enters
            a zip code of 07302, and the state is New York, it
            will catch it. In most instances the function is correct.
            In the event that a range of zip codes changes, you
            can specify a new range of valid zip codes with the
            addzip() function. Unfortunately, creating a function
            that checks every individual zip code in the United
            States and it's territories would be enormous and
            difficult to maintain since every year dozens of new
            zip codes are added. These new zip codes however
            fall within the ranges checked by this function.

            For more information on zip codes and their territories,
            you can buy a national zip code directory from your
            local post office. New zip code directories are published
            each year.


See Also: state() isstate() addzip() statecode()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson