我已经准备好了-您可以使用它:
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');解决方法
我需要将全州名称转换为其官方州地址代码。例如,从纽约String出发,我需要生产NY。现在,我可以将所有内容放入一个哈希图中,但是似乎必须有一个实用程序?我在Android环境中。我不想为这个工具导入一个大型库。谢谢