I have a string where i have multiple values. The key and value are separated by * and the whole value is separated by $.
Below is the example:
String agf = "abc*pqr$sfd*ghn$atr*mnb$tre*fgt";
And now I want to put the value of this into hashmap in key value pair.
Below is the code i was using but didnt work for converting it into hashmap. Please guide.
String agf = "abc*pqr$sfd*ghn$atr*mnb$tre*fgt";
String []tmp = StringUtils.split(agf,'*');
for (String v : tmp) {
String[] t = StringUtils.split(v,'$');
map.put(t[0], t[1]);
}
*and$in the arguments tosplit, then it's going to work.