本文整理汇总了C++中StringBuilder::AppendString方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuilder::AppendString方法的具体用法?C++ StringBuilder::AppendString怎么用?C++ StringBuilder::AppendString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuilder
的用法示例。
在下文中一共展示了StringBuilder::AppendString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComposeSearchUrl
String URLUtil::ComposeSearchUrl(
/* [in] */ const String& inQuery,
/* [in] */ const String& templateStr,
/* [in] */ const String& queryPlaceHolder)
{
Int32 placeHolderIndex = templateStr.IndexOf(queryPlaceHolder);
if (placeHolderIndex < 0) {
return String(NULL);
}
String query;
StringBuilder buffer;
buffer.AppendString(templateStr.Substring(0, placeHolderIndex));
//try {
// query = java.net.URLEncoder.encode(inQuery, "utf-8");
AutoPtr<IURLEncoder> URLEncoder;
assert(0);
// CURLEncoder::New((IURLEncoder**)&URLEncoder);
if (FAILED(URLEncoder->Encode(inQuery, String("utf-8"), &query))){
return String(NULL);
}
buffer.AppendString(query);
//} catch (UnsupportedEncodingException ex) {
// return null;
//}
buffer.AppendString(templateStr.Substring(
placeHolderIndex + queryPlaceHolder.GetLength()));
return buffer.ToString();
}
示例2: WriteDateTime
String DateUtils::WriteDateTime(
/* [in] */ ICalendar* cal,
/* [in,out] */ String* sb)
{
Int32 n;
StringBuilder sbTemp;
sbTemp.AppendString(*sb);
cal->Get(ICalendar::YEAR, &n);
sbTemp.SetChar(3, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(2, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(1, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(0, (Char32)('0'+n%10));
cal->Get(ICalendar::MONTH, &n);
n = n + 1;
sbTemp.SetChar(5, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(4, (Char32)('0'+n%10));
cal->Get(ICalendar::DAY_OF_MONTH, &n);
sbTemp.SetChar(7, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(6, (Char32)('0'+n%10));
sbTemp.SetChar(8, 'T');
cal->Get(ICalendar::HOUR_OF_DAY, &n);
sbTemp.SetChar(10, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(9, (Char32)('0'+n%10));
cal->Get(ICalendar::MINUTE, &n);
sbTemp.SetChar(12, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(11, (Char32)('0'+n%10));
cal->Get(ICalendar::SECOND, &n);
sbTemp.SetChar(14, (Char32)('0'+n%10));
n /= 10;
sbTemp.SetChar(13, (Char32)('0'+n%10));
*sb = sbTemp.ToString();
return *sb;
}
示例3:
ECode CX509CRLSelector::ToString(
/* [out] */ String *str)
{
StringBuilder result;
result.AppendCStr("X509CRLSelector:\n[");
if (mIssuerNames) {
result.AppendCStr("\n IssuerNames:\n [");
Int32 size;
mIssuerNames->GetSize(&size);
for (Int32 i = 0; i < size; i++) {
result.AppendCStr("\n ");
AutoPtr<IInterface> elem;
mIssuerNames->Get(i, (IInterface**)&elem);
String name;
ICharSequence::Probe(elem)->ToString(&name);
result.AppendString(name);
}
result.AppendCStr("\n ]");
}
if (mMinCRL != NULL) {
result.AppendCStr("\n minCRL: ");
result.AppendObject(mMinCRL.Get());
}
if (mMaxCRL != NULL) {
result.AppendCStr("\n mMaxCRL: ");
result.AppendObject(mMaxCRL.Get());
}
if (mDateAndTime != -1) {
result.AppendCStr("\n dateAndTime: ");
AutoPtr<IDate> dt;
CDate::New(mDateAndTime, (IDate**)&dt);
result.AppendObject(dt.Get());
}
if (mCertificateChecking != NULL) {
result.AppendCStr("\n certificateChecking: ");
result.AppendObject(mCertificateChecking.Get());
}
result.AppendCStr("\n]");
return result.ToString(str);
}