码迷,mamicode.com
首页 > 编程语言 > 详细

Java 常用工具类

时间:2016-07-20 13:14:34      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:

MessageFormat

FormatElement:
         { ArgumentIndex }
         { ArgumentIndex , FormatType }
         { ArgumentIndex , FormatType , FormatStyle }

 

 FormatType
         number

         date

         time

         choice(需要使用ChoiceFormat)

 

 FormatStyle:
         short
         medium
         long
         full
         integer
         currency
         percent
         SubformatPattern(子模式)

 

String str = "I‘m not a {0}, age is {1,number,short}", height is {2,number,#.#};

String message = "oh, ‘{0}‘ is a pig";  

Object[] array = new Object[]{"ZhangSan"};  

String value = MessageFormat.format(message, array);  

System.out.println(value); 

Java 常用工具类

标签:

原文地址:http://www.cnblogs.com/leonkobe/p/5687818.html

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