home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / ISSTATE.PRG < prev    next >
Encoding:
Text File  |  1991-07-02  |  3.1 KB  |  70 lines

  1. /*
  2.     Program: ISSTATE()
  3.     System: GRUMPFISH LIBRARY
  4.     Author: Greg Lief
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.0 Version
  7.     Compile instructions: clipper isstate /n/w/a
  8.     Very special thanks to Mike Clerc for his invaluable input!
  9.  
  10.     Data validation function for State abbreviations
  11.  
  12.     Calls: APICK()      (function in APICK.PRG)
  13. */
  14.  
  15. //───── begin preprocessor directives
  16.  
  17. #include "grump.ch"
  18.  
  19. //───── end preprocessor directives
  20.  
  21. function IsState()
  22. static statecod_ := { "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", ;
  23.                       "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", ;
  24.                       "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", ;
  25.                       "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", ;
  26.                       "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", ;
  27.                       "VT", "VA", "WA", "WV", "WI", "WY",  NIL,  NIL, "AS", ;
  28.                       "FM", "GU", "MP", "MH", "PW", "PR", "VI",  NIL,  NIL, ;
  29.                       "AB", "BC", "MB", "NB", "NF", "NT", "NS", "ON", "PE", ;
  30.                       "PQ", "SK", "YT" }
  31. local states_ := { "Alabama", "Alaska", "Arizona", "Arkansas", ;
  32.                     "California", "Colorado", "Connecticut", "Delaware", ;
  33.                     "District of Columbia", "Florida", "Georgia", "Hawaii", ;
  34.                     "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", ;
  35.                     "Kentucky", "Louisiana", "Maine", "Maryland", ;
  36.                     "Massachusetts", "Michigan", "Minnesota", "Mississippi", ;
  37.                     "Missouri", "Montana", "Nebraska", "Nevada", ;
  38.                     "New Hampshire", "New Jersey", "New Mexico", "New York", ;
  39.                     "North Carolina", "North Dakota", "Ohio", "Oklahoma", ;
  40.                     "Oregon", "Pennsylvania", "Rhode Island", ;
  41.                     "South Carolina", "South Dakota", "Tennessee", "Texas", ;
  42.                     "Utah", "Vermont", "Virginia", "Washington", ;
  43.                     "West Virginia", "Wisconsin", "Wyoming", "~─", ;
  44.                     "~U.S. Terrorities", "American Samoa", ;
  45.                     "Federated Micronesia", "Guam", "Mariana Islands", ;
  46.                     "Marshall Islands", "Palau Islands", "Puerto Rico", ;
  47.                     "Virgin Islands", "~─", "~Canadian Provinces", "Alberta", ;
  48.                     "British Columbia", "Manitoba", "New Brunswick", ;
  49.                     "Newfoundland", "Northwest Territories", "Nova Scotia", ;
  50.                     "Ontario", "Prince Edward Island", "Quebec", ;
  51.                     "Saskatchewan", "Yukon" }
  52. local ret_val := .T., element, get := getactive()
  53. if ascan(statecod_, get:buffer) == 0
  54.    if ! empty(get:buffer)
  55.       keyboard trim(get:buffer)
  56.    endif
  57.    element := apick(6, 29, 18, 51, states_, , , , len(states_), .f., "+gr/b")
  58.    if element = 0
  59.       ret_val := .f.
  60.    else
  61.       get:varPut(statecod_[element])
  62.    endif
  63. endif
  64. return ret_val
  65.  
  66. * end function IsState()
  67. *--------------------------------------------------------------------*
  68.  
  69. * eof isstate.prg
  70.