Substitute tokens in a StringTag(s): String/Number

Object[] params = new Object[]{"hello", "!"};
String msg = MessageFormat.format("{0} world {1]", params);
// hello world !
java.text.MessageFormat is a very powerful API, you should study the javadoc to see all the possibilities.


If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]