我们知道java中可以用MessageFormat.format来格式化字符串.这个方法在我们的实际开发中经常用到,有点类似模板,这样我们就不需要用很恶心的拼接字符串了.如下面 String s1="my blogWebSite is {0} and sinaWeiBo is {1} "; String s2=MessageFormat.format(s1,"http://www.3lai8.com","http://weibo.com/javaee6&q
java.text.MessageFormat格式化字符串时的小技巧 public static void main(String[] args) throws InterruptedException { MessageFormat form = new MessageFormat( "{2,date,yyyy-MM-dd HH:mm:ss.SSS} The disk \"{1}\" contains {0,number,#.##} file(s).{3}");