java - substring in hashmap -
i trying create map , use map later. creating map this.
string line = "0010020 027071040yn address line 1"; map.put(line.substring(0,8).tostring(), line.substring(8).tostring());
so map looks "0010020=027071040yn address line 1"
.
and working fine.but when trying retrieve entry map, not able it. trying retrieve this:-
string temp= map.get("0010020").tostring();
the same thing working fine if don't use substring while putting data map. need use substring. please let me know how proceed
the issue space comes after 0010020
in
0010020 027071040yn... ^
you including space in substring(0,8)
not in lookup.
in other words, key in map "0010020 "
whereas you're looking "0010020"
.
Comments
Post a Comment