Ruby hashes for converting states to abbreviations and back
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STATE_ABBR_TO_NAME = { | |
'AL' => 'Alabama', | |
'AK' => 'Alaska', | |
'AS' => 'America Samoa', | |
'AZ' => 'Arizona', | |
'AR' => 'Arkansas', | |
'CA' => 'California', | |
'CO' => 'Colorado', | |
'CT' => 'Connecticut', | |
'DE' => 'Delaware', | |
'DC' => 'District of Columbia', | |
'FM' => 'Federated States Of Micronesia', | |
'FL' => 'Florida', | |
'GA' => 'Georgia', | |
'GU' => 'Guam', | |
'HI' => 'Hawaii', | |
'ID' => 'Idaho', | |
'IL' => 'Illinois', | |
'IN' => 'Indiana', | |
'IA' => 'Iowa', | |
'KS' => 'Kansas', | |
'KY' => 'Kentucky', | |
'LA' => 'Louisiana', | |
'ME' => 'Maine', | |
'MH' => 'Marshall Islands', | |
'MD' => 'Maryland', | |
'MA' => 'Massachusetts', | |
'MI' => 'Michigan', | |
'MN' => 'Minnesota', | |
'MS' => 'Mississippi', | |
'MO' => 'Missouri', | |
'MT' => 'Montana', | |
'NE' => 'Nebraska', | |
'NV' => 'Nevada', | |
'NH' => 'New Hampshire', | |
'NJ' => 'New Jersey', | |
'NM' => 'New Mexico', | |
'NY' => 'New York', | |
'NC' => 'North Carolina', | |
'ND' => 'North Dakota', | |
'OH' => 'Ohio', | |
'OK' => 'Oklahoma', | |
'OR' => 'Oregon', | |
'PW' => 'Palau', | |
'PA' => 'Pennsylvania', | |
'PR' => 'Puerto Rico', | |
'RI' => 'Rhode Island', | |
'SC' => 'South Carolina', | |
'SD' => 'South Dakota', | |
'TN' => 'Tennessee', | |
'TX' => 'Texas', | |
'UT' => 'Utah', | |
'VT' => 'Vermont', | |
'VI' => 'Virgin Island', | |
'VA' => 'Virginia', | |
'WA' => 'Washington', | |
'WV' => 'West Virginia', | |
'WI' => 'Wisconsin', | |
'WY' => 'Wyoming' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STATE_NAME_TO_ABBR = { | |
'Alabama' => 'AL', | |
'Alaska' => 'AK', | |
'America Samoa' => 'AS', | |
'Arizona' => 'AZ', | |
'Arkansas' => 'AR', | |
'California' => 'CA', | |
'Colorado' => 'CO', | |
'Connecticut' => 'CT', | |
'Delaware' => 'DE', | |
'District of Columbia' => 'DC', | |
'Federated States of Micronesia' => 'FM', | |
'Florida' => 'FL', | |
'Georgia' => 'GA', | |
'Guam' => 'GU', | |
'Hawaii' => 'HI', | |
'Idaho' => 'ID', | |
'Illinois' => 'IL', | |
'Indiana' => 'IN', | |
'Iowa' => 'IA', | |
'Kansas' => 'KS', | |
'Kentucky' => 'KY', | |
'Louisiana' => 'LA', | |
'Maine' => 'ME', | |
'Maryland' => 'MD', | |
'Massachusetts' => 'MA', | |
'Marshall Islands' => 'MH', | |
'Michigan' => 'MI', | |
'Minnesota' => 'MN', | |
'Mississippi' => 'MS', | |
'Missouri' => 'MO', | |
'Montana' => 'MT', | |
'Nebraska' => 'NE', | |
'Nevada' => 'NV', | |
'New Hampshire' => 'NH', | |
'New Jersey' => 'NJ', | |
'New Mexico' => 'NM', | |
'New York' => 'NY', | |
'North Carolina' => 'NC', | |
'North Dakota' => 'ND', | |
'Northern Mariana Islands' => 'MP', | |
'Ohio' => 'OH', | |
'Oklahoma' => 'OK', | |
'Oregon' => 'OR', | |
'Palau' => 'PW', | |
'Pennsylvania' => 'PA', | |
'Puerto Rico' => 'PR', | |
'Rhode Island' => 'RI', | |
'South Carolina' => 'SC', | |
'South Dakota' => 'SD', | |
'Tennessee' => 'TN', | |
'Texas' => 'TX', | |
'Utah' => 'UT', | |
'Vermont' => 'VT', | |
'Virgin Island' => 'VI', | |
'Virginia' => 'VA', | |
'Washington' => 'WA', | |
'West Virginia' => 'WV', | |
'Wisconsin' => 'WI', | |
'Wyoming' => 'WY' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STATE_NAME_TO_ABBR_LOWER = { | |
'alabama' => 'AL', | |
'alaska' => 'AK', | |
'america samoa' => 'AS', | |
'arizona' => 'AZ', | |
'arkansas' => 'AR', | |
'california' => 'CA', | |
'colorado' => 'CO', | |
'connecticut' => 'CT', | |
'delaware' => 'DE', | |
'district of columbia' => 'DC', | |
'washington d.c.' => 'DC', | |
'washington dc' => 'DC', | |
'federated states of micronesia' => 'FM', | |
'micronesia' => 'FM', | |
'florida' => 'FL', | |
'georgia' => 'GA', | |
'guam' => 'GU', | |
'hawaii' => 'HI', | |
'idaho' => 'ID', | |
'illinois' => 'IL', | |
'indiana' => 'IN', | |
'iowa' => 'IA', | |
'kansas' => 'KS', | |
'kentucky' => 'KY', | |
'louisiana' => 'LA', | |
'maine' => 'ME', | |
'maryland' => 'MD', | |
'massachusetts' => 'MA', | |
'marshall islands' => 'MH', | |
'michigan' => 'MI', | |
'minnesota' => 'MN', | |
'mississippi' => 'MS', | |
'missouri' => 'MO', | |
'montana' => 'MT', | |
'nebraska' => 'NE', | |
'nevada' => 'NV', | |
'new hampshire' => 'NH', | |
'new jersey' => 'NJ', | |
'new mexico' => 'NM', | |
'new york' => 'NY', | |
'north carolina' => 'NC', | |
'north dakota' => 'ND', | |
'northern mariana islands' => 'MP', | |
'mariana islands' => 'MP', | |
'ohio' => 'OH', | |
'oklahoma' => 'OK', | |
'oregon' => 'OR', | |
'palau' => 'PW', | |
'pennsylvania' => 'PA', | |
'puerto rico' => 'PR', | |
'rhode island' => 'RI', | |
'south carolina' => 'SC', | |
'south dakota' => 'SD', | |
'tennessee' => 'TN', | |
'texas' => 'TX', | |
'utah' => 'UT', | |
'vermont' => 'VT', | |
'virgin island' => 'VI', | |
'virginia' => 'VA', | |
'washington' => 'WA', | |
'west virginia' => 'WV', | |
'wisconsin' => 'WI', | |
'wyoming' => 'WY' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment