Mega Code Archive

 
Categories / Java / Development Class
 

Substitute tokens in a String

import java.text.MessageFormat; public class Main {   public static void main(String[] argv) {     Object[] params = new Object[] { "hello", "!" };     System.out.println(MessageFormat.format("{0} world {1}", params));   } } //hello world !