码迷,mamicode.com
首页 > 其他好文 > 详细

MessageFormat格式化一个消息

时间:2018-01-07 19:59:42      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:pack   div   ase   tostring   col   gpo   ack   ast   tool   

一个简单点的case

package com.zh.tool;

import java.text.MessageFormat;


public class test {
    public static void main(String[] args) {
        String paraString = "xxxxx{0}xxxxx{1}xxxxxxxx{2}xxxxxx";
        System.out.println(MessageFormat.format(paraString.toString(), "para1", "para2", "para3"));
    }
}

结果:

xxxxxpara1xxxxxpara2xxxxxxxxpara3xxxxxx

 

MessageFormat格式化一个消息

标签:pack   div   ase   tostring   col   gpo   ack   ast   tool   

原文地址:https://www.cnblogs.com/lan-writenbook/p/8228884.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!