Wednesday, 11 September 2013

Replace markers in a String with values from a HashMap

Replace markers in a String with values from a HashMap

I have a text saved in Java string:
this is my text with markers {1}
second row {2} ....
Each marker has associated value (ex. {1} => 23, {2} => 45) in a HashMap.
I want to generate output where each marker will be replaced with
associated values. The formatting of text should be preserved. How can I
solve this problem?

No comments:

Post a Comment