微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.text.MessageFormat.Field的实例源码

项目:j2objc    文件Support_messageformat.java   
public void t_format_with_FieldPosition() {

        String pattern = "On {4,date} at {3,time},he ate {2,number,integer} hamburger{2,choice,1#|1<s} and drank {1,number} litres of coke. That was {0,1#just enough|1<more than enough} food!";
        messageformat format = new messageformat(pattern,Locale.US);

        Date date = new GregorianCalendar(2005,1,28,14,20,16).getTime();
        Integer hamburgers = new Integer(8);
        Object[] objects = new Object[] { hamburgers,new Double(3.5),hamburgers,date,date };

        super.text = "On Feb 28,2005 at 2:20:16 PM,he ate 8 hamburgers and drank 3.5 litres of coke. That was more than enough food!";

        // test with messageformat.Field.ARGUMENT
        t_FormatWithField(1,format,objects,null,Field.ARGUMENT,3,15);

        // test other format fields that are included in the formatted text
        t_FormatWithField(2,DateFormat.Field.AM_PM,0);
        t_FormatWithField(3,NumberFormat.Field.FRACTION,0);

        // test fields that are not included in the formatted text
        t_FormatWithField(4,DateFormat.Field.ERA,0);
        t_FormatWithField(5,NumberFormat.Field.EXPONENT_SIGN,0);
    }
项目:In-the-Box-Fork    文件Support_messageformat.java   
public void t_format_with_FieldPosition() {

        String pattern = "On {4,0);
    }
项目:cn1    文件Support_messageformat.java   
public void t_format_with_FieldPosition() {

        String pattern = "On {4,0);
    }
项目:freeVM    文件Support_messageformat.java   
public void t_format_with_FieldPosition() {

        String pattern = "On {4,0);
    }
项目:j2objc    文件Support_messageformat.java   
private Vector<FieldContainer> getMessageVector1() {
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(3,6,4));
    v.add(new FieldContainer(3,DateFormat.Field.MONTH));
    v.add(new FieldContainer(6,7,4));
    v.add(new FieldContainer(7,9,DateFormat.Field.DAY_OF_MONTH));
    v.add(new FieldContainer(9,11,4));
    v.add(new FieldContainer(11,15,DateFormat.Field.YEAR));
    v.add(new FieldContainer(19,3));
    v.add(new FieldContainer(19,DateFormat.Field.HOUR1));
    v.add(new FieldContainer(20,21,3));
    v.add(new FieldContainer(21,23,DateFormat.Field.MINUTE));
    v.add(new FieldContainer(23,24,3));
    v.add(new FieldContainer(24,26,DateFormat.Field.SECOND));
    v.add(new FieldContainer(26,27,3));
    v.add(new FieldContainer(27,29,DateFormat.Field.AM_PM));
    v.add(new FieldContainer(38,39,2));
    v.add(new FieldContainer(38,NumberFormat.Field.INTEGER));
    v.add(new FieldContainer(49,50,2));
    v.add(new FieldContainer(61,62,1));
    v.add(new FieldContainer(61,NumberFormat.Field.INTEGER));
    v.add(new FieldContainer(62,63,1));
    v.add(new FieldContainer(62,NumberFormat.Field.DECIMAL_SEParaTOR));
    v.add(new FieldContainer(63,64,1));
    v.add(new FieldContainer(63,NumberFormat.Field.FRACTION));
    v.add(new FieldContainer(90,106,0));
    return v;
}
项目:In-the-Box-Fork    文件Support_messageformat.java   
private Vector<FieldContainer> getMessageVector1() {
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(3,0));
    return v;
}
项目:cn1    文件Support_messageformat.java   
private Vector<FieldContainer> getMessageVector1() {
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(3,0));
    return v;
}
项目:freeVM    文件Support_messageformat.java   
private Vector<FieldContainer> getMessageVector1() {
    Vector<FieldContainer> v = new Vector<FieldContainer>();
    v.add(new FieldContainer(3,0));
    return v;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。