OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 2008-2013, International Business Machines Corporation and | 3 * Copyright (c) 2008-2014, International Business Machines Corporation and |
4 * others. All Rights Reserved. | 4 * others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 //! [getBestPatternExample1] | 6 //! [getBestPatternExample1] |
7 #include <iostream> | 7 #include <iostream> |
8 #include "unicode/smpdtfmt.h" | 8 #include "unicode/smpdtfmt.h" |
9 #include "unicode/dtptngen.h" | 9 #include "unicode/dtptngen.h" |
10 #include "unicode/ustdio.h" | 10 #include "unicode/ustdio.h" |
11 //! [getBestPatternExample1] | 11 //! [getBestPatternExample1] |
12 | 12 |
13 using namespace std; | 13 using namespace std; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 u_fprintf(f, "%-20S", dateReturned.getTerminatedBuffer()
); | 61 u_fprintf(f, "%-20S", dateReturned.getTerminatedBuffer()
); |
62 delete dtfg; | 62 delete dtfg; |
63 delete sdf; | 63 delete sdf; |
64 } | 64 } |
65 u_fprintf(f,"\n"); | 65 u_fprintf(f,"\n"); |
66 } | 66 } |
67 /* close the file resource */ | 67 /* close the file resource */ |
68 u_fclose(f); | 68 u_fclose(f); |
69 delete cal; | 69 delete cal; |
70 //! [getBestPatternExample] | 70 //! [getBestPatternExample] |
71 /* output of the sample code: | |
72 ***************************************************************************
******************************** | |
73 Skeleton en_US
fr_FR zh_CN | |
74 | |
75 yQQQQ 4th quarter 1999
4e trimestre 1999 1999年第四季度 | |
76 | |
77 yMMMM October 1999
octobre 1999 1999年10月 | |
78 | |
79 MMMMd October 13
13 octobre 10月13日 | |
80 | |
81 hhmm 11:58 PM
11:58 PM 下午11:58 | |
82 | |
83 jjmm 11:58 PM
23:58 下午11:58 | |
84 | |
85 ***************************************************************************
*********************************/ | |
86 } | 71 } |
87 | 72 |
88 static void addPatternExample() { | 73 static void addPatternExample() { |
89 | 74 |
90 u_printf("======================================================
==================\n"); | 75 u_printf("======================================================
==================\n"); |
91 u_printf(" addPatternExample()\n"); | 76 u_printf(" addPatternExample()\n"); |
92 u_printf("\n"); | 77 u_printf("\n"); |
93 u_printf(" Use addPattern API to add new '. von' to existing pattern\n")
; | 78 u_printf(" Use addPattern API to add new '. von' to existing pattern\n")
; |
94 u_printf("==============================================================
==========\n"); | 79 u_printf("==============================================================
==========\n"); |
95 //! [addPatternExample] | 80 //! [addPatternExample] |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 dateReturned = sdf->format(date, dateReturned, status); | 144 dateReturned = sdf->format(date, dateReturned, status); |
160 u_fprintf(out, "%S\n", UnicodeString("Pattern after replacement:
").getTerminatedBuffer()); | 145 u_fprintf(out, "%S\n", UnicodeString("Pattern after replacement:
").getTerminatedBuffer()); |
161 u_fprintf(out, "%S\n", newPattern.getTerminatedBuffer()); | 146 u_fprintf(out, "%S\n", newPattern.getTerminatedBuffer()); |
162 u_fprintf(out, "%S\n", UnicodeString("Date/Time format in fr_FR:").getTe
rminatedBuffer()); | 147 u_fprintf(out, "%S\n", UnicodeString("Date/Time format in fr_FR:").getTe
rminatedBuffer()); |
163 u_fprintf(out, "%S\n", dateReturned.getTerminatedBuffer()); | 148 u_fprintf(out, "%S\n", dateReturned.getTerminatedBuffer()); |
164 delete sdf; | 149 delete sdf; |
165 delete dtfg; | 150 delete dtfg; |
166 delete zone; | 151 delete zone; |
167 delete cal; | 152 delete cal; |
168 u_fclose(out); | 153 u_fclose(out); |
169 | 154 » //! [replaceFieldTypesExample] |
170 » » //! [replaceFieldTypesExample] | |
171 » » /* output of the sample code: | |
172 ************************************************************************
************************* | |
173 Pattern before replacement: | |
174 EEEE d MMMM y HH:mm:ss zzzz | |
175 Date/Time format in fr_FR: | |
176 jeudi 14 octobre 1999 05:58:59 heure avancée d’Europe centrale | |
177 Pattern after replacement: | |
178 EEEE d MMMM y HH:mm:ss vvvv | |
179 Date/Time format in fr_FR: | |
180 jeudi 14 octobre 1999 05:58:59 heure de l’Europe centrale | |
181 | |
182 ************************************************************************
*************************/ | |
183 } | 155 } |
184 | 156 |
185 int main (int argc, char* argv[]) | 157 int main (int argc, char* argv[]) |
186 { | 158 { |
187 getBestPatternExample(); | 159 getBestPatternExample(); |
188 addPatternExample(); | 160 addPatternExample(); |
189 replaceFieldTypesExample(); | 161 replaceFieldTypesExample(); |
190 return 0; | 162 return 0; |
191 } | 163 } |
OLD | NEW |