MainMenu

Home Java Overview Maven Tutorials

Sunday, 25 February 2024

Get USA State Name by USA City Name

Get State Name by City name Get State Name by City Name in USA

This article is having a method which will give you state name as per city name.
This lengthy function don't need to write again , just copy below code and use it as per your need.

public static String getUsaState(String city) {
Map cs = new HashMap();

cs.put("New York","New York");
cs.put("Los Angeles","California");
cs.put("Chicago","Illinois");
cs.put("Houston","Texas");
cs.put("New York","New York");
cs.put("Los Angeles","California");
cs.put("Chicago","Illinois");
cs.put("Houston","Texas");
cs.put("Philadelphia","Pennsylvania");
cs.put("Phoenix","Arizona");
cs.put("San Antonio","Texas");
cs.put("San Diego","California");
cs.put("Dallas","Texas");
cs.put("San Jose","California");
cs.put("Austin","Texas");
cs.put("Jacksonville","Florida");
cs.put("Indianapolis","Indiana");
cs.put("San Francisco","California");
cs.put("Columbus","Ohio");
cs.put("Fort Worth","Texas");
cs.put("Charlotte","North Carolina");
cs.put("Detroit","Michigan");
cs.put("El Paso","Texas");
cs.put("Memphis","Tennessee");
cs.put("Boston","Massachusetts");
cs.put("Seattle","Washington");
cs.put("Denver","Colorado");
cs.put("Washington","District of Columbia");
cs.put("Nashville","Tennessee");
cs.put("Baltimore","Maryland");
cs.put("Louisville","Kentucky");
cs.put("Portland","Oregon");
cs.put("Oklahoma City","Oklahoma");
cs.put("Milwaukee","Wisconsin");
cs.put("Las Vegas","Nevada");
cs.put("Albuquerque","New Mexico");
cs.put("Tucson","Arizona");
cs.put("Fresno","California");
cs.put("Sacramento","California");
cs.put("Long Beach","California");
cs.put("Kansas City","Missouri");
cs.put("Mesa","Arizona");
cs.put("Virginia Beach","Virginia");
cs.put("Atlanta","Georgia");
cs.put("Colorado Springs","Colorado");
cs.put("Raleigh","North Carolina");
cs.put("Omaha","Nebraska");
cs.put("Miami","Florida");
cs.put("Oakland","California");
cs.put("Tulsa","Oklahoma");
cs.put("Minneapolis","Minnesota");
cs.put("Cleveland","Ohio");
cs.put("Wichita","Kansas");
cs.put("Arlington","Texas");
cs.put("New Orleans","Louisiana");
cs.put("Bakersfield","California");
cs.put("Tampa","Florida");
cs.put("Honolulu","Hawai'i");
cs.put("Anaheim","California");
cs.put("Aurora","Colorado");
cs.put("Santa Ana","California");
cs.put("St. Louis","Missouri");
cs.put("Riverside","California");
cs.put("Corpus Christi","Texas");
cs.put("Pittsburgh","Pennsylvania");
cs.put("Lexington","Kentucky");
cs.put("Anchorage","Alaska");
cs.put("Stockton","California");
cs.put("Cincinnati","Ohio");
cs.put("Saint Paul","Minnesota");
cs.put("Toledo","Ohio");
cs.put("Newark","New Jersey");
cs.put("Greensboro","North Carolina");
cs.put("Plano","Texas");
cs.put("Henderson","Nevada");
cs.put("Lincoln","Nebraska");
cs.put("Buffalo","New York");
cs.put("Fort Wayne","Indiana");
cs.put("Jersey City","New Jersey");
cs.put("Chula Vista","California");
cs.put("Orlando","Florida");
cs.put("St. Petersburg","Florida");
cs.put("Norfolk","Virginia");
cs.put("Chandler","Arizona");
cs.put("Laredo","Texas");
cs.put("Madison","Wisconsin");
cs.put("Durham","North Carolina");
cs.put("Lubbock","Texas");
cs.put("Winston-Salem","North Carolina");
cs.put("Garland","Texas");
cs.put("Glendale","Arizona");
cs.put("Hialeah","Florida");
cs.put("Reno","Nevada");
cs.put("Baton Rouge","Louisiana");
cs.put("Irvine","California");
cs.put("Chesapeake","Virginia");
cs.put("Irving","Texas");
cs.put("Scottsdale","Arizona");
cs.put("North Las Vegas","Nevada");
cs.put("Fremont","California");
cs.put("Gilbert","Arizona");
cs.put("San Bernardino","California");
cs.put("Boise","Idaho");
cs.put("Birmingham","Alabama");
cs.put("Rochester","New York");
cs.put("Richmond","Virginia");
cs.put("Spokane","Washington");
cs.put("Des Moines","Iowa");
cs.put("Montgomery","Alabama");
cs.put("Modesto","California");
cs.put("Fayetteville","North Carolina");
cs.put("Tacoma","Washington");
cs.put("Shreveport","Louisiana");
cs.put("Fontana","California");
cs.put("Oxnard","California");
cs.put("Aurora","Illinois");
cs.put("Moreno Valley","California");
cs.put("Akron","Ohio");
cs.put("Yonkers","New York");
cs.put("Columbus","Georgia");
cs.put("Augusta","Georgia");
cs.put("Little Rock","Arkansas");
cs.put("Amarillo","Texas");
cs.put("Mobile","Alabama");
cs.put("Huntington Beach","California");
cs.put("Glendale","California");
cs.put("Grand Rapids","Michigan");
cs.put("Salt Lake City","Utah");
cs.put("Tallahassee","Florida");
cs.put("Huntsville","Alabama");
cs.put("Worcester","Massachusetts");
cs.put("Knoxville","Tennessee");
cs.put("Grand Prairie","Texas");
cs.put("Newport News","Virginia");
cs.put("Brownsville","Texas");
cs.put("Santa Clarita","California");
cs.put("Overland Park","Kansas");
cs.put("Providence","Rhode Island");
cs.put("Jackson","Mississippi");
cs.put("Garden Grove","California");
cs.put("Oceanside","California");
cs.put("Chattanooga","Tennessee");
cs.put("Fort Lauderdale","Florida");
cs.put("Rancho Cucamonga","California");
cs.put("Santa Rosa","California");
cs.put("Port St. Lucie","Florida");
cs.put("Ontario","California");
cs.put("Tempe","Arizona");
cs.put("Vancouver","Washington");
cs.put("Springfield","Missouri");
cs.put("Cape Coral","Florida");
cs.put("Pembroke Pines","Florida");
cs.put("Sioux Falls","South Dakota");
cs.put("Peoria","Arizona");
cs.put("Lancaster","California");
cs.put("Elk Grove","California");
cs.put("Corona","California");
cs.put("Eugene","Oregon");
cs.put("Salem","Oregon");
cs.put("Palmdale","California");
cs.put("Salinas","California");
cs.put("Springfield","Massachusetts");
cs.put("Pasadena","Texas");
cs.put("Rockford","Illinois");
cs.put("Pomona","California");
cs.put("Hayward","California");
cs.put("Fort Collins","Colorado");
cs.put("Joliet","Illinois");
cs.put("Escondido","California");
cs.put("Kansas City","Kansas");
cs.put("Torrance","California");
cs.put("Bridgeport","Connecticut");
cs.put("Alexandria","Virginia");
cs.put("Sunnyvale","California");
cs.put("Cary","North Carolina");
cs.put("Lakewood","Colorado");
cs.put("Hollywood","Florida");
cs.put("Paterson","New Jersey");
cs.put("Syracuse","New York");
cs.put("Naperville","Illinois");
cs.put("McKinney","Texas");
cs.put("Mesquite","Texas");
cs.put("Clarksville","Tennessee");
cs.put("Savannah","Georgia");
cs.put("Dayton","Ohio");
cs.put("Orange","California");
cs.put("Fullerton","California");
cs.put("Pasadena","California");
cs.put("Hampton","Virginia");
cs.put("McAllen","Texas");
cs.put("Killeen","Texas");
cs.put("Warren","Michigan");
cs.put("West Valley City","Utah");
cs.put("Columbia","South Carolina");
cs.put("New Haven","Connecticut");
cs.put("Sterling Heights","Michigan");
cs.put("Olathe","Kansas");
cs.put("Miramar","Florida");
cs.put("Thousand Oaks","California");
cs.put("Frisco","Texas");
cs.put("Cedar Rapids","Iowa");
cs.put("Topeka","Kansas");
cs.put("Visalia","California");
cs.put("Waco","Texas");
cs.put("Elizabeth","New Jersey");
cs.put("Bellevue","Washington");
cs.put("Gainesville","Florida");
cs.put("Simi Valley","California");
cs.put("Charleston","South Carolina");
cs.put("Carrollton","Texas");
cs.put("Coral Springs","Florida");
cs.put("Stamford","Connecticut");
cs.put("Hartford","Connecticut");
cs.put("Concord","California");
cs.put("Roseville","California");
cs.put("Thornton","Colorado");
cs.put("Kent","Washington");
cs.put("Lafayette","Louisiana");
cs.put("Surprise","Arizona");
cs.put("Denton","Texas");
cs.put("Victorville","California");
cs.put("Evansville","Indiana");
cs.put("Midland","Texas");
cs.put("Santa Clara","California");
cs.put("Athens","Georgia");
cs.put("Allentown","Pennsylvania");
cs.put("Abilene","Texas");
cs.put("Beaumont","Texas");
cs.put("Vallejo","California");
cs.put("Independence","Missouri");
cs.put("Springfield","Illinois");
cs.put("Ann Arbor","Michigan");
cs.put("Provo","Utah");
cs.put("Peoria","Illinois");
cs.put("Norman","Oklahoma");
cs.put("Berkeley","California");
cs.put("El Monte","California");
cs.put("Murfreesboro","Tennessee");
cs.put("Lansing","Michigan");
cs.put("Columbia","Missouri");
cs.put("Downey","California");
cs.put("Costa Mesa","California");
cs.put("Inglewood","California");
cs.put("Miami Gardens","Florida");
cs.put("Manchester","New Hampshire");
cs.put("Elgin","Illinois");
cs.put("Wilmington","North Carolina");
cs.put("Waterbury","Connecticut");
cs.put("Fargo","North Dakota");
cs.put("Arvada","Colorado");
cs.put("Carlsbad","California");
cs.put("Westminster","Colorado");
cs.put("Rochester","Minnesota");
cs.put("Gresham","Oregon");
cs.put("Clearwater","Florida");
cs.put("Lowell","Massachusetts");
cs.put("West Jordan","Utah");
cs.put("Pueblo","Colorado");
cs.put("San Buenaventura (Ventura)","California");
cs.put("Fairfield","California");
cs.put("West Covina","California");
cs.put("Billings","Montana");
cs.put("Murrieta","California");
cs.put("High Point","North Carolina");
cs.put("Round Rock","Texas");
cs.put("Richmond","California");
cs.put("Cambridge","Massachusetts");
cs.put("Norwalk","California");
cs.put("Odessa","Texas");
cs.put("Antioch","California");
cs.put("Temecula","California");
cs.put("Green Bay","Wisconsin");
cs.put("Everett","Washington");
cs.put("Wichita Falls","Texas");
cs.put("Burbank","California");
cs.put("Palm Bay","Florida");
cs.put("Centennial","Colorado");
cs.put("Daly City","California");
cs.put("Richardson","Texas");
cs.put("Pompano Beach","Florida");
cs.put("Broken Arrow","Oklahoma");
cs.put("North Charleston","South Carolina");
cs.put("West Palm Beach","Florida");
cs.put("Boulder","Colorado");
cs.put("Rialto","California");
cs.put("Santa Maria","California");
cs.put("El Cajon","California");
cs.put("Davenport","Iowa");
cs.put("Erie","Pennsylvania");
cs.put("Las Cruces","New Mexico");
cs.put("South Bend","Indiana");
cs.put("Flint","Michigan");
cs.put("Kenosha","Wisconsin");
return cs.get(city);
}

No comments:

Post a Comment