Do resource bundles in Java support runtime string substitution?

Posted by Benju on Stack Overflow See other posts from Stack Overflow or by Benju
Published on 2010-03-15T22:56:35Z Indexed on 2010/03/15 22:59 UTC
Read the original article Hit count: 166

Filed under:
|

Can you do the following with a Java ResourceBundle?

In the properties file...

example.dynamicresource=You currently have {0} accounts.

At runtime...

int accountAcount = 3;
bundle.get("example.dynamicresource",accountCount,param2,...);

To give a result of

"You currently have 3 accounts."

© Stack Overflow or respective owner

Related posts about java

Related posts about resourcebundle