MessageFormat

public static void main(String[] args){
        String pattern = "hello {0}, 你好";
        String rt = MessageFormat.format(pattern, new Object[]{"world"});
        System.err.println(rt);
        String pattern1 = "日期 {1,date} 時間 {1,time} ,天氣{0}";
        String rt1 = MessageFormat.format(pattern1, "晴朗",new Date());
        System.err.println(rt1);
    }

hello world, 你好java

日期 2014-12-30 時間 10:20:40 ,天氣晴朗code

相關文章
相關標籤/搜索