replace values in a String from a Hashtable in Java
Posted
by Adnan
on Stack Overflow
See other posts from Stack Overflow
or by Adnan
Published on 2010-06-07T08:06:49Z
Indexed on
2010/06/07
8:12 UTC
Read the original article
Hit count: 264
My string looks like;
String values = "I am from UK, and you are from FR";
and my hashtable;
Hashtable countries = new Hashtable();
countries.put("United Kingdom", new String("UK"));
countries.put("France", new String("FR"));
What would be the most effective way to change the values in my string with the values from the hashtable accordingly. These are just 2 values to change, but in my case I will have 100+
© Stack Overflow or respective owner