Posted By

chrisaiv on 06/01/10


Tagged

ruby state


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

t9md
kentonnewby
Priestd09


Ruby: State Abbreviations


 / Published in: Ruby
 

Easy way to populate a drop-down menu

  1. STATE_ABBR = {
  2. 'AL' => 'Alabama',
  3. 'AK' => 'Alaska',
  4. 'AZ' => 'Arizona',
  5. 'AR' => 'Arkansas',
  6. 'CA' => 'California',
  7. 'CO' => 'Colorado',
  8. 'CT' => 'Connecticut',
  9. 'DE' => 'Delaware',
  10. 'FL' => 'Florida',
  11. 'GA' => 'Georgia',
  12. 'HI' => 'Hawaii',
  13. 'ID' => 'Idaho',
  14. 'IL' => 'Illinois',
  15. 'IN' => 'Indiana',
  16. 'IA' => 'Iowa',
  17. 'KS' => 'Kansas',
  18. 'KY' => 'Kentucky',
  19. 'LA' => 'Louisiana',
  20. 'ME' => 'Maine',
  21. 'MD' => 'Maryland',
  22. 'MA' => 'Massachusetts',
  23. 'MI' => 'Michigan',
  24. 'MN' => 'Minnesota',
  25. 'MS' => 'Mississippi',
  26. 'MO' => 'Missouri',
  27. 'MT' => 'Montana',
  28. 'NE' => 'Nebraska',
  29. 'NV' => 'Nevada',
  30. 'NH' => 'New Hampshire',
  31. 'NJ' => 'New Jersey',
  32. 'NM' => 'New Mexico',
  33. 'NY' => 'New York',
  34. 'NC' => 'North Carolina',
  35. 'ND' => 'North Dakota',
  36. 'OH' => 'Ohio',
  37. 'OK' => 'Oklahoma',
  38. 'OR' => 'Oregon',
  39. 'PA' => 'Pennsylvania',
  40. 'RI' => 'Rhode Island',
  41. 'SC' => 'South Carolina',
  42. 'SD' => 'South Dakota',
  43. 'TN' => 'Tennessee',
  44. 'TX' => 'Texas',
  45. 'UT' => 'Utah',
  46. 'VT' => 'Vermont',
  47. 'VA' => 'Virginia',
  48. 'WA' => 'Washington',
  49. 'WV' => 'West Virginia',
  50. 'WI' => 'Wisconsin',
  51. 'WY' => 'Wyoming'
  52. }.sort

Report this snippet  

You need to login to post a comment.