Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:47:21+00:00 2026-06-05T15:47:21+00:00

I need to convert full state name to its official state address code. For

  • 0

I need to convert full state name to its official state address code. For example from the String New York, I need to produce NY. Now I could put this all in a hashmap, but it seems there must be a utility for this? I am in an Android environment. I don’t want to import a large library just for this one util however. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:47:23+00:00Added an answer on June 5, 2026 at 3:47 pm

    I have it ready-made – you can use it:

    Map<String, String> states = new HashMap<String, String>();
    states.put("Alabama","AL");
    states.put("Alaska","AK");
    states.put("Alberta","AB");
    states.put("American Samoa","AS");
    states.put("Arizona","AZ");
    states.put("Arkansas","AR");
    states.put("Armed Forces (AE)","AE");
    states.put("Armed Forces Americas","AA");
    states.put("Armed Forces Pacific","AP");
    states.put("British Columbia","BC");
    states.put("California","CA");
    states.put("Colorado","CO");
    states.put("Connecticut","CT");
    states.put("Delaware","DE");
    states.put("District Of Columbia","DC");
    states.put("Florida","FL");
    states.put("Georgia","GA");
    states.put("Guam","GU");
    states.put("Hawaii","HI");
    states.put("Idaho","ID");
    states.put("Illinois","IL");
    states.put("Indiana","IN");
    states.put("Iowa","IA");
    states.put("Kansas","KS");
    states.put("Kentucky","KY");
    states.put("Louisiana","LA");
    states.put("Maine","ME");
    states.put("Manitoba","MB");
    states.put("Maryland","MD");
    states.put("Massachusetts","MA");
    states.put("Michigan","MI");
    states.put("Minnesota","MN");
    states.put("Mississippi","MS");
    states.put("Missouri","MO");
    states.put("Montana","MT");
    states.put("Nebraska","NE");
    states.put("Nevada","NV");
    states.put("New Brunswick","NB");
    states.put("New Hampshire","NH");
    states.put("New Jersey","NJ");
    states.put("New Mexico","NM");
    states.put("New York","NY");
    states.put("Newfoundland","NF");
    states.put("North Carolina","NC");
    states.put("North Dakota","ND");
    states.put("Northwest Territories","NT");
    states.put("Nova Scotia","NS");
    states.put("Nunavut","NU");
    states.put("Ohio","OH");
    states.put("Oklahoma","OK");
    states.put("Ontario","ON");
    states.put("Oregon","OR");
    states.put("Pennsylvania","PA");
    states.put("Prince Edward Island","PE");
    states.put("Puerto Rico","PR");
    states.put("Quebec","QC");
    states.put("Rhode Island","RI");
    states.put("Saskatchewan","SK");
    states.put("South Carolina","SC");
    states.put("South Dakota","SD");
    states.put("Tennessee","TN");
    states.put("Texas","TX");
    states.put("Utah","UT");
    states.put("Vermont","VT");
    states.put("Virgin Islands","VI");
    states.put("Virginia","VA");
    states.put("Washington","WA");
    states.put("West Virginia","WV");
    states.put("Wisconsin","WI");
    states.put("Wyoming","WY");
    states.put("Yukon Territory","YT");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to convert full name to first and last name. Is this possible
Sometimes I need to convert a piece of code or an entire project from
I need to convert a python code into an equivalent java code. Python makes
I need to convert a HashMap<String, Object> to an array; could anyone show me
I need to convert HTML documents (generated from DocBook XML documents) to the Wiki
I need to convert a string to another which has removed anything before the
I need to convert a timestamp string to java.util.Date . E.g.: MMDDYYHHMMSS to MM-DD-YY
I need to convert a string of text containing a long url into the
I need to convert PDF pages to TIF files from within my app (or
I'm trying to convert the string produced from the __DATE__ macro into a time_t

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.