Java tutorial
//package com.java2s; public class Main { public static String format(String str, String... args) { for (int i = 0; i < args.length; i++) { str = str.replaceFirst("\\{" + i + "\\}", args[i]); } return str; } }