java - How can I use HashMap values to form a String? -


i have following code maps specific string characters letters:

 string = "94466602777330999666887770223377778077778 883 336687777";     string[] tokens = a.split("(?<=(.))(?!\\1)");     map<string, string> hmap = new hashmap<string, string>();      hmap.put("2", "a");     hmap.put("22", "b");     hmap.put("222", "c");     hmap.put("3", "d");     hmap.put("33", "e");     hmap.put("333", "f");     hmap.put("4", "g");     hmap.put("44", "h");     hmap.put("444", "i");     hmap.put("5", "j");     hmap.put("55", "k");     hmap.put("555", "l");     hmap.put("6", "m");     hmap.put("66", "n");     hmap.put("666", "o");     hmap.put("7", "p");     hmap.put("77", "q");     hmap.put("777", "r");     hmap.put("7777", "s");     hmap.put("8", "t");     hmap.put("88", "u");     hmap.put("888", "v");     hmap.put("9", "w");     hmap.put("99", "x");     hmap.put("999", "y");     hmap.put("9999", "z");     hmap.put("1", ".");     hmap.put("0", " "); 

after doing hashmap, want return string coverts previous string "94466602777330999666887770223377778077778 883 336687777" "who best students"

you can use stringbuilder class form string.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -