本文整理汇总了C++中ChoiceFormat::applyPattern方法的典型用法代码示例。如果您正苦于以下问题:C++ ChoiceFormat::applyPattern方法的具体用法?C++ ChoiceFormat::applyPattern怎么用?C++ ChoiceFormat::applyPattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChoiceFormat
的用法示例。
在下文中一共展示了ChoiceFormat::applyPattern方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fpos
//.........这里部分代码省略.........
//
#if 0 // ICU 4.8 deprecates and disables the ChoiceFormat getters.
int32_t retCount;
const double* retLimits = fileform->getLimits( retCount );
if ((retCount == 4) && (retLimits)
&& (retLimits[0] == -1.0)
&& (retLimits[1] == 0.0)
&& (retLimits[2] == 1.0)
&& (retLimits[3] == 2.0)) {
it_logln("getLimits tested!");
}else{
it_errln("*** getLimits unexpected result!");
}
const UnicodeString* retFormats = fileform->getFormats( retCount );
if ((retCount == 4) && (retFormats)
&& (retFormats[0] == "are corrupted files")
&& (retFormats[1] == "are no files")
&& (retFormats[2] == "is one file")
&& (retFormats[3] == "are {2} files")) {
it_logln("getFormats tested!");
}else{
it_errln("*** getFormats unexpected result!");
}
#endif
UnicodeString checkstr2[] = {
"There is no folder on Disk_A",
"There is one folder on Disk_A",
"There are many folders on Disk_A",
"There are many folders on Disk_A"
};
fileform->applyPattern("0#is no folder|1#is one folder|2#are many folders", status );
if (status == U_ZERO_ERROR)
it_logln("status applyPattern OK!");
if (!chkstatus( status, "*** test_complex_example pattform" )) {
delete fileform;
delete filenumform;
delete pattform;
return;
}
pattform->setFormat( 0, *fileform );
fpos = 0;
for (i = 0; i < 4; ++i) {
str = "";
status = U_ZERO_ERROR;
testArgs[0] = Formattable((int32_t)i);
testArgs[2] = testArgs[0];
res2 = pattform->format(testArgs, 3, str, fpos, status );
if (!chkstatus( status, "*** test_complex_example format 2" )) {
delete fileform;
delete filenumform;
delete pattform;
return;
}
it_logln(UnicodeString() + i + UnicodeString(" -> ") + res2);
if (res2 != checkstr2[i]) {
it_errln("*** test_complex_example res string");
it_errln(UnicodeString("*** ") + i + UnicodeString(" -> '") + res2 + UnicodeString("' unlike '") + checkstr2[i] + UnicodeString("' ! "));
}
}
const double limits_A[] = {1,2,3,4,5,6,7};
const UnicodeString monthNames_A[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
ChoiceFormat* form_A = new ChoiceFormat(limits_A, monthNames_A, 7);