| OLD | NEW |
| 1 /******************************************************************************
** | 1 /****************************************************************************** |
| 2 * Copyright (C) 2008-2013, International Business Machines Corporation and | 2 * Copyright (C) 2008-2014, International Business Machines Corporation and |
| 3 * others. All Rights Reserved. | 3 * others. All Rights Reserved. |
| 4 ******************************************************************************* | 4 ******************************************************************************* |
| 5 */ | 5 */ |
| 6 //! [dtitvfmtPreDefined1] | 6 //! [dtitvfmtPreDefined1] |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include "unicode/dtitvfmt.h" | 8 #include "unicode/dtitvfmt.h" |
| 9 #include "unicode/ustdio.h" | 9 #include "unicode/ustdio.h" |
| 10 //! [dtitvfmtPreDefined1] | 10 //! [dtitvfmtPreDefined1] |
| 11 | 11 |
| 12 using namespace std; | 12 using namespace std; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 //get the DateIntervalFormat | 64 //get the DateIntervalFormat |
| 65 dtitvfmtEn->format(dtitvsample[i],formatEn,pos,status); | 65 dtitvfmtEn->format(dtitvsample[i],formatEn,pos,status); |
| 66 dtitvfmtJa->format(dtitvsample[i],formatJa,pos,status); | 66 dtitvfmtJa->format(dtitvsample[i],formatJa,pos,status); |
| 67 u_fprintf(out,"%-35S%-35S\n", formatEn.getTerminatedBuffer(),formatJa.g
etTerminatedBuffer()); | 67 u_fprintf(out,"%-35S%-35S\n", formatEn.getTerminatedBuffer(),formatJa.g
etTerminatedBuffer()); |
| 68 delete dtitvfmtEn; | 68 delete dtitvfmtEn; |
| 69 delete dtitvfmtJa; | 69 delete dtitvfmtJa; |
| 70 i++; | 70 i++; |
| 71 } | 71 } |
| 72 u_fclose(out); | 72 u_fclose(out); |
| 73 //! [dtitvfmtPreDefined] | 73 //! [dtitvfmtPreDefined] |
| 74 /* output of the sample code: | |
| 75 ******************************************************************************
*************************************************************************** | |
| 76 Skeleton from
to Date Int
erval in en_US Date Interval in Ja | |
| 77 yMMMd 2007-10-10 10:10:10
2008-10-10 10:10:10 Nov 10, 2007 – Nov 10, 2
008 2007年11月10日~2008年11月10日 | |
| 78 MMMMd 2008-10-10 10:10:10
2008-11-10 10:10:10 November 10 – December 1
0 11月10日~12月10日 | |
| 79 jm 2008-11-10 10:10:10
2008-11-10 15:10:10 10:10 AM – 3:10 PM
10:10~15:10 | |
| 80 | |
| 81 ******************************************************************************
***************************************************************************/ | |
| 82 } | 74 } |
| 83 | 75 |
| 84 static void dtitvfmtCustomized() { | 76 static void dtitvfmtCustomized() { |
| 85 | 77 |
| 86 u_printf("==============================================================
=================\n"); | 78 u_printf("==============================================================
=================\n"); |
| 87 u_printf("\n"); | 79 u_printf("\n"); |
| 88 u_printf(" dtitvfmtCustomized()\n"); | 80 u_printf(" dtitvfmtCustomized()\n"); |
| 89 u_printf("\n"); | 81 u_printf("\n"); |
| 90 u_printf(" Use DateIntervalFormat to create customized date interval format
for yMMMd, Hm"); | 82 u_printf(" Use DateIntervalFormat to create customized date interval format
for yMMMd, Hm"); |
| 91 u_printf("\n"); | 83 u_printf("\n"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 DateIntervalFormat* dtitvfmtJa = DateIntervalFormat::createInstance(
skeletons[i],Locale::getJapanese(),dtitvinf,status); | 124 DateIntervalFormat* dtitvfmtJa = DateIntervalFormat::createInstance(
skeletons[i],Locale::getJapanese(),dtitvinf,status); |
| 133 formatEn.remove(); | 125 formatEn.remove(); |
| 134 formatJa.remove(); | 126 formatJa.remove(); |
| 135 dtitvfmtEn->format(dtitvsample[j],formatEn,pos,status); | 127 dtitvfmtEn->format(dtitvsample[j],formatEn,pos,status); |
| 136 dtitvfmtJa->format(dtitvsample[j],formatJa,pos,status); | 128 dtitvfmtJa->format(dtitvsample[j],formatJa,pos,status); |
| 137 u_fprintf(out,"%-45S%-35S\n", formatEn.getTerminatedBuff
er(),formatJa.getTerminatedBuffer()); | 129 u_fprintf(out,"%-45S%-35S\n", formatEn.getTerminatedBuff
er(),formatJa.getTerminatedBuffer()); |
| 138 } | 130 } |
| 139 } | 131 } |
| 140 u_fclose(out); | 132 u_fclose(out); |
| 141 //! [dtitvfmtCustomized] | 133 //! [dtitvfmtCustomized] |
| 142 /* output of the sample code: | |
| 143 ******************************************************************************
********************************************************************************
* | |
| 144 Skeleton from to
Date Interval in en_US
Date Interval in Ja | |
| 145 yMMMd 2007-10-10 10:10:10 2007-11-
10 10:10:10 2007 Diff Oct 10 --- Nov 10
2007 Diff 10月 10 --- 11月 10 | |
| 146 yMMMd 2007-11-10 10:10:10 2007-11-
10 22:10:10 Nov 10, 2007
2007年11月10 | |
| 147 Hm 2007-10-10 10:10:10 2007-11-
10 10:10:10 10/10/2007, 10:10 ~~~ 11/10/2007, 10:10
2007/10/10 10:10 ~~~ 2007/11/10 10:10 | |
| 148 Hm 2007-11-10 10:10:10 2007-11-
10 22:10:10 2007 Nov 10 10:10 ~ 22:10
2007 11月 10 10:10 ~ 22:10 | |
| 149 ******************************************************************************
********************************************************************************
*/ | |
| 150 } | 134 } |
| 151 | 135 |
| 152 int main (int argc, char* argv[]) | 136 int main (int argc, char* argv[]) |
| 153 { | 137 { |
| 154 dtitvfmtPreDefined(); | 138 dtitvfmtPreDefined(); |
| 155 dtitvfmtCustomized(); | 139 dtitvfmtCustomized(); |
| 156 return 0; | 140 return 0; |
| 157 } | 141 } |
| OLD | NEW |