Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2026233
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类: Java

2011-06-29 16:22:23

  1. Docs
    • http://developer.android.com/reference/java/text/Format.html
  2. Classes
    • Locale
    • TimeZone
    • Format
      Convert objects or values, such as numeric values and dates, and their string representations.

      In some cases these representations may be localized or contain localized characters or strings. For example, a numeric formatter such as DecimalFormat may convert a numeric value such as 12345 to the string "$12,345". It may also parse the string back into a numeric value. A date and time formatter like SimpleDateFormat may represent a specific date, encoded numerically, as a string such as "Wednesday, February 26, 1997 AD".

      Many of the concrete subclasses of Format employ the notion of a pattern. A pattern is a string representation of the rules which govern the conversion between values and strings.

      • NumberFormat
        This class provides the interface for formatting and parsing numbers.
      • DecimalFormat
      • ChoiceFormat
      • MessageFormat
        Produces concatenated messages in language-neutral way.

        MessageFormat takes a set of objects, formats them and then inserts the formatted strings into the pattern at the appropriate places. eg:
        1. Object[] arguments = {
        2.          Integer.valueOf(7), new Date(System.currentTimeMillis()),
        3.          "a disturbance in the Force"};
        4.  String result = MessageFormat.format(
        5.          "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",
        6.          arguments);
        7.   
        8.  Output:
        9.   
        10.  At 12:30 PM on Jul 3, 2053, there was a disturbance in the Force on planet 7.
      • DateFormat
      • SimpleDateFormat
    • Currency
    • xxx
  3. xxx
阅读(1083) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~