當前位置: 首頁>>代碼示例>>Java>>正文


Java TextStyle.SHORT屬性代碼示例

本文整理匯總了Java中java.time.format.TextStyle.SHORT屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextStyle.SHORT屬性的具體用法?Java TextStyle.SHORT怎麽用?Java TextStyle.SHORT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.time.format.TextStyle的用法示例。


在下文中一共展示了TextStyle.SHORT屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: data_preferredZones

@DataProvider(name="preferredZones")
    Object[][] data_preferredZones() {
        return new Object[][] {
            {"America/New_York", "Eastern Standard Time", none,      Locale.ENGLISH, TextStyle.FULL},
//          {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
            {"Europe/Paris",     "Central European Time", none,      Locale.ENGLISH, TextStyle.FULL},
            {"CET",              "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL},
            {"Asia/Shanghai",    "China Standard Time",   none,      Locale.ENGLISH, TextStyle.FULL},
            {"Asia/Taipei",      "China Standard Time",   preferred, Locale.ENGLISH, TextStyle.FULL},
            {"America/Chicago",  "CST",                   none,      Locale.ENGLISH, TextStyle.SHORT},
            {"Asia/Taipei",      "CST",                   preferred, Locale.ENGLISH, TextStyle.SHORT},
            {"Australia/South",  "ACST",                  preferred_s, Locale.ENGLISH, TextStyle.SHORT},
            {"America/Chicago",  "CDT",                   none,        Locale.ENGLISH, TextStyle.SHORT},
            {"Asia/Shanghai",    "CDT",                   preferred_s, Locale.ENGLISH, TextStyle.SHORT},
       };
    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:16,代碼來源:TestZoneTextPrinterParser.java

示例2: provider_japaneseEra

@DataProvider(name="print_JapaneseChronology")
Object[][] provider_japaneseEra() {
   return new Object[][] {
        {ERA,           TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
        {ERA,           TextStyle.SHORT, 2, "Heisei"},
        {ERA,           TextStyle.NARROW, 2, "H"},
   };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:TestTextPrinter.java

示例3: data_preferredZones

@DataProvider(name="preferredZones")
    Object[][] data_preferredZones() {
        return new Object[][] {
            {"America/New_York", "Eastern Standard Time", none,      Locale.ENGLISH, TextStyle.FULL},
//          {"EST",              "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
            {"Europe/Paris",     "Central European Time", none,      Locale.ENGLISH, TextStyle.FULL},
//          {"CET",              "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL}, no three-letter ID in CLDR
            {"Asia/Shanghai",    "China Standard Time",   none,      Locale.ENGLISH, TextStyle.FULL},
            {"Asia/Macau",       "China Standard Time",   preferred, Locale.ENGLISH, TextStyle.FULL},
            {"Asia/Taipei",      "Taipei Standard Time",  preferred, Locale.ENGLISH, TextStyle.FULL},
            {"America/Chicago",  "CST",                   none,      Locale.ENGLISH, TextStyle.SHORT},
            {"Asia/Taipei",      "CST",                   preferred, Locale.ENGLISH, TextStyle.SHORT},
            {"Australia/South",  "ACST",                  preferred_s, Locale.ENGLISH, TextStyle.SHORT},
            {"America/Chicago",  "CDT",                   none,        Locale.ENGLISH, TextStyle.SHORT},
            {"Asia/Shanghai",    "CDT",                   preferred_s, Locale.ENGLISH, TextStyle.SHORT},
       };
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:TestZoneTextPrinterParser.java

示例4: data_print_localized

@DataProvider(name="print_localized")
Object[][] data_print_localized() {
    return new Object[][] {
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_UTC, "GMT"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0100, "GMT+01:00"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0123, "GMT+01:23"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P0023, "GMT+00:23"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_P012345, "GMT+01:23:45"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-00:00:45"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0100, "GMT-01:00"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0123, "GMT-01:23"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M0023, "GMT-00:23"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M012345, "GMT-01:23:45"},
            {TextStyle.FULL, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-00:00:45"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_UTC, "GMT"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0100, "GMT+1"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0123, "GMT+1:23"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P0023, "GMT+0:23"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_P012345, "GMT+1:23:45"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-0:00:45"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0100, "GMT-1"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0123, "GMT-1:23"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M0023, "GMT-0:23"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M012345, "GMT-1:23:45"},
            {TextStyle.SHORT, DT_2012_06_30_12_30_40, OFFSET_M000045, "GMT-0:00:45"},
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:27,代碼來源:TCKOffsetPrinterParser.java

示例5: test_print_localized

@Test(dataProvider="print_localized")
public void test_print_localized(TextStyle style, LocalDateTime ldt, ZoneOffset offset, String expected) {
    OffsetDateTime odt = OffsetDateTime.of(ldt, offset);
    ZonedDateTime zdt = ldt.atZone(offset);

    DateTimeFormatter f = new DateTimeFormatterBuilder().appendLocalizedOffset(style)
                                                        .toFormatter();
    assertEquals(f.format(odt), expected);
    assertEquals(f.format(zdt), expected);
    assertEquals(f.parse(expected, ZoneOffset::from), offset);

    if (style == TextStyle.FULL) {
        f = new DateTimeFormatterBuilder().appendPattern("ZZZZ")
                                          .toFormatter();
        assertEquals(f.format(odt), expected);
        assertEquals(f.format(zdt), expected);
        assertEquals(f.parse(expected, ZoneOffset::from), offset);

        f = new DateTimeFormatterBuilder().appendPattern("OOOO")
                                          .toFormatter();
        assertEquals(f.format(odt), expected);
        assertEquals(f.format(zdt), expected);
        assertEquals(f.parse(expected, ZoneOffset::from), offset);
    }

    if (style == TextStyle.SHORT) {
        f = new DateTimeFormatterBuilder().appendPattern("O")
                                          .toFormatter();
        assertEquals(f.format(odt), expected);
        assertEquals(f.format(zdt), expected);
        assertEquals(f.parse(expected, ZoneOffset::from), offset);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:33,代碼來源:TCKOffsetPrinterParser.java

示例6: provider_number

@DataProvider(name="parseNumber")
Object[][] provider_number() {
    return new Object[][] {
        {DAY_OF_MONTH, TextStyle.FULL, 1, "1"},
        {DAY_OF_MONTH, TextStyle.FULL, 2, "2"},
        {DAY_OF_MONTH, TextStyle.FULL, 30, "30"},
        {DAY_OF_MONTH, TextStyle.FULL, 31, "31"},

        {DAY_OF_MONTH, TextStyle.SHORT, 1, "1"},
        {DAY_OF_MONTH, TextStyle.SHORT, 2, "2"},
        {DAY_OF_MONTH, TextStyle.SHORT, 30, "30"},
        {DAY_OF_MONTH, TextStyle.SHORT, 31, "31"},
   };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:14,代碼來源:TestTextParser.java

示例7: data_text

@DataProvider(name="printText")
Object[][] data_text() {
    return new Object[][] {
        {DAY_OF_WEEK, TextStyle.FULL, 1, "Monday"},
        {DAY_OF_WEEK, TextStyle.FULL, 2, "Tuesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 3, "Wednesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 4, "Thursday"},
        {DAY_OF_WEEK, TextStyle.FULL, 5, "Friday"},
        {DAY_OF_WEEK, TextStyle.FULL, 6, "Saturday"},
        {DAY_OF_WEEK, TextStyle.FULL, 7, "Sunday"},

        {DAY_OF_WEEK, TextStyle.SHORT, 1, "Mon"},
        {DAY_OF_WEEK, TextStyle.SHORT, 2, "Tue"},
        {DAY_OF_WEEK, TextStyle.SHORT, 3, "Wed"},
        {DAY_OF_WEEK, TextStyle.SHORT, 4, "Thu"},
        {DAY_OF_WEEK, TextStyle.SHORT, 5, "Fri"},
        {DAY_OF_WEEK, TextStyle.SHORT, 6, "Sat"},
        {DAY_OF_WEEK, TextStyle.SHORT, 7, "Sun"},

        {DAY_OF_MONTH, TextStyle.FULL, 1, "1"},
        {DAY_OF_MONTH, TextStyle.FULL, 2, "2"},
        {DAY_OF_MONTH, TextStyle.FULL, 3, "3"},
        {DAY_OF_MONTH, TextStyle.FULL, 28, "28"},
        {DAY_OF_MONTH, TextStyle.FULL, 29, "29"},
        {DAY_OF_MONTH, TextStyle.FULL, 30, "30"},
        {DAY_OF_MONTH, TextStyle.FULL, 31, "31"},

        {DAY_OF_MONTH, TextStyle.SHORT, 1, "1"},
        {DAY_OF_MONTH, TextStyle.SHORT, 2, "2"},
        {DAY_OF_MONTH, TextStyle.SHORT, 3, "3"},
        {DAY_OF_MONTH, TextStyle.SHORT, 28, "28"},
        {DAY_OF_MONTH, TextStyle.SHORT, 29, "29"},
        {DAY_OF_MONTH, TextStyle.SHORT, 30, "30"},
        {DAY_OF_MONTH, TextStyle.SHORT, 31, "31"},

        {MONTH_OF_YEAR, TextStyle.FULL, 1, "January"},
        {MONTH_OF_YEAR, TextStyle.FULL, 12, "December"},

        {MONTH_OF_YEAR, TextStyle.SHORT, 1, "Jan"},
        {MONTH_OF_YEAR, TextStyle.SHORT, 12, "Dec"},
   };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:42,代碼來源:TCKDateTimeTextPrinting.java

示例8: provider_text

@DataProvider(name="parseText")
Object[][] provider_text() {
    return new Object[][] {
        {DAY_OF_WEEK, TextStyle.FULL, 1, "Monday"},
        {DAY_OF_WEEK, TextStyle.FULL, 2, "Tuesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 3, "Wednesday"},
        {DAY_OF_WEEK, TextStyle.FULL, 4, "Thursday"},
        {DAY_OF_WEEK, TextStyle.FULL, 5, "Friday"},
        {DAY_OF_WEEK, TextStyle.FULL, 6, "Saturday"},
        {DAY_OF_WEEK, TextStyle.FULL, 7, "Sunday"},

        {DAY_OF_WEEK, TextStyle.SHORT, 1, "Mon"},
        {DAY_OF_WEEK, TextStyle.SHORT, 2, "Tue"},
        {DAY_OF_WEEK, TextStyle.SHORT, 3, "Wed"},
        {DAY_OF_WEEK, TextStyle.SHORT, 4, "Thu"},
        {DAY_OF_WEEK, TextStyle.SHORT, 5, "Fri"},
        {DAY_OF_WEEK, TextStyle.SHORT, 6, "Sat"},
        {DAY_OF_WEEK, TextStyle.SHORT, 7, "Sun"},

        {MONTH_OF_YEAR, TextStyle.FULL, 1, "January"},
        {MONTH_OF_YEAR, TextStyle.FULL, 12, "December"},

        {MONTH_OF_YEAR, TextStyle.SHORT, 1, "Jan"},
        {MONTH_OF_YEAR, TextStyle.SHORT, 12, "Dec"},

        {QUARTER_OF_YEAR, TextStyle.FULL, 1, "1st quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 2, "2nd quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 3, "3rd quarter"},
        {QUARTER_OF_YEAR, TextStyle.FULL, 4, "4th quarter"},

        {QUARTER_OF_YEAR, TextStyle.SHORT, 1, "Q1"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 2, "Q2"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 3, "Q3"},
        {QUARTER_OF_YEAR, TextStyle.SHORT, 4, "Q4"},

        {QUARTER_OF_YEAR, TextStyle.NARROW, 1, "1"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 2, "2"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 3, "3"},
        {QUARTER_OF_YEAR, TextStyle.NARROW, 4, "4"},
   };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:41,代碼來源:TestTextParser.java

示例9: data_text

@DataProvider(name = "Text")
Object[][] data_text() {
    return new Object[][] {
        {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg"},
        {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter"},
        {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua"},
        {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui"},
        {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex"},
        {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b"},
        {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom"},

        {DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
        {DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
        {DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
        {DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
        {DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
        {DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
        {DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},

        {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
        {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
        {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
        {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
        {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
        {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
        {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
        {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
        {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
        {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
        {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
        {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},

        {MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
        {MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
        {MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
        {MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
        {MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
        {MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
        {MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
        {MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
        {MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
        {MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
        {MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
        {MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},

    };
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:47,代碼來源:TestDateTimeTextProviderWithLocale.java

示例10: data_text

@DataProvider(name = "Text")
Object[][] data_text() {
    return new Object[][] {
        {DAY_OF_WEEK, 1, TextStyle.SHORT, enUS, "Mon"},
        {DAY_OF_WEEK, 2, TextStyle.SHORT, enUS, "Tue"},
        {DAY_OF_WEEK, 3, TextStyle.SHORT, enUS, "Wed"},
        {DAY_OF_WEEK, 4, TextStyle.SHORT, enUS, "Thu"},
        {DAY_OF_WEEK, 5, TextStyle.SHORT, enUS, "Fri"},
        {DAY_OF_WEEK, 6, TextStyle.SHORT, enUS, "Sat"},
        {DAY_OF_WEEK, 7, TextStyle.SHORT, enUS, "Sun"},

        {DAY_OF_WEEK, 1, TextStyle.FULL, enUS, "Monday"},
        {DAY_OF_WEEK, 2, TextStyle.FULL, enUS, "Tuesday"},
        {DAY_OF_WEEK, 3, TextStyle.FULL, enUS, "Wednesday"},
        {DAY_OF_WEEK, 4, TextStyle.FULL, enUS, "Thursday"},
        {DAY_OF_WEEK, 5, TextStyle.FULL, enUS, "Friday"},
        {DAY_OF_WEEK, 6, TextStyle.FULL, enUS, "Saturday"},
        {DAY_OF_WEEK, 7, TextStyle.FULL, enUS, "Sunday"},

        {MONTH_OF_YEAR, 1, TextStyle.SHORT, enUS, "Jan"},
        {MONTH_OF_YEAR, 2, TextStyle.SHORT, enUS, "Feb"},
        {MONTH_OF_YEAR, 3, TextStyle.SHORT, enUS, "Mar"},
        {MONTH_OF_YEAR, 4, TextStyle.SHORT, enUS, "Apr"},
        {MONTH_OF_YEAR, 5, TextStyle.SHORT, enUS, "May"},
        {MONTH_OF_YEAR, 6, TextStyle.SHORT, enUS, "Jun"},
        {MONTH_OF_YEAR, 7, TextStyle.SHORT, enUS, "Jul"},
        {MONTH_OF_YEAR, 8, TextStyle.SHORT, enUS, "Aug"},
        {MONTH_OF_YEAR, 9, TextStyle.SHORT, enUS, "Sep"},
        {MONTH_OF_YEAR, 10, TextStyle.SHORT, enUS, "Oct"},
        {MONTH_OF_YEAR, 11, TextStyle.SHORT, enUS, "Nov"},
        {MONTH_OF_YEAR, 12, TextStyle.SHORT, enUS, "Dec"},

        {MONTH_OF_YEAR, 1, TextStyle.FULL, enUS, "January"},
        {MONTH_OF_YEAR, 2, TextStyle.FULL, enUS, "February"},
        {MONTH_OF_YEAR, 3, TextStyle.FULL, enUS, "March"},
        {MONTH_OF_YEAR, 4, TextStyle.FULL, enUS, "April"},
        {MONTH_OF_YEAR, 5, TextStyle.FULL, enUS, "May"},
        {MONTH_OF_YEAR, 6, TextStyle.FULL, enUS, "June"},
        {MONTH_OF_YEAR, 7, TextStyle.FULL, enUS, "July"},
        {MONTH_OF_YEAR, 8, TextStyle.FULL, enUS, "August"},
        {MONTH_OF_YEAR, 9, TextStyle.FULL, enUS, "September"},
        {MONTH_OF_YEAR, 10, TextStyle.FULL, enUS, "October"},
        {MONTH_OF_YEAR, 11, TextStyle.FULL, enUS, "November"},
        {MONTH_OF_YEAR, 12, TextStyle.FULL, enUS, "December"},

        {AMPM_OF_DAY, 0, TextStyle.SHORT, enUS, "AM"},
        {AMPM_OF_DAY, 1, TextStyle.SHORT, enUS, "PM"},

    };
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:50,代碼來源:TestDateTimeTextProvider.java


注:本文中的java.time.format.TextStyle.SHORT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。