当前位置: 首页>>代码示例>>C++>>正文


C++ UnicodeString::sprintf方法代码示例

本文整理汇总了C++中UnicodeString::sprintf方法的典型用法代码示例。如果您正苦于以下问题:C++ UnicodeString::sprintf方法的具体用法?C++ UnicodeString::sprintf怎么用?C++ UnicodeString::sprintf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnicodeString的用法示例。


在下文中一共展示了UnicodeString::sprintf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void __fastcall TForm3::AddItems(const int HowMany)
{
	for(int i = 0; i < HowMany; i++) {
		UnicodeString NextItemText;
		NextItemText.sprintf(L"[%d] [%ls] [%ls%ls]", FTotal, names[FTotal % 9], Host, cats[FTotal % 4]);
		FTotal++;
		FStrings->Add(NextItemText);
	}
	FTotal++;
}
开发者ID:FMXExpress,项目名称:Firemonkey,代码行数:10,代码来源:Customnik.cpp

示例2: IntToHex

//---------------------------------------------------------------------------
UnicodeString IntToHex(uintptr_t Int, uintptr_t MinChars)
{
  UnicodeString Result;
  Result.sprintf(L"%X", Int);
  intptr_t Pad = MinChars - Result.Length();
  if (Pad > 0)
  {
    for (intptr_t I = 0; I < Pad; I++)
    {
      Result.Insert(L'0', 1);
    }
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:15,代码来源:Sysutils.cpp

示例3: Int64ToStr

//---------------------------------------------------------------------------
UnicodeString Int64ToStr(__int64 Value)
{
  UnicodeString Result;
  Result.sprintf(L"%lld", Value);
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:7,代码来源:Sysutils.cpp

示例4: InitializeTranslationTable

void __fastcall TVersionInfo::InitializeTranslationTable(void)
{
  #pragma pack(push, 1)
    union TTranslationTableEntry
    {
      struct struct_Codes
      {
        WORD LanguageCode;
        WORD CharsetCode;
      } Codes;

      DWORD RawData;
	};
  #pragma pack(pop)

  void *xlatebuffer;
  unsigned int BufferLength = 0;

  UnicodeString TempString;

  QueryValue(L"\\VarFileInfo\\Translation",xlatebuffer, BufferLength);
  TTranslationTableEntry* ATranslationTableEntry;
  ATranslationTableEntry = static_cast<TTranslationTableEntry*>(xlatebuffer);
  // We assume that the translation table is stored correctly;
  // the operating system provides no other means to retrieve
  // the count of items, so dividing table size by
  // sizeof(table entry) is the only means to achieve this.
  assert(BufferLength % sizeof(TTranslationTableEntry) == 0);

  while (BufferLength != 0)
  {
    TempString = L"";
	TempString.sprintf(L"%.4X%.4X", ATranslationTableEntry->Codes.LanguageCode,
                                  ATranslationTableEntry->Codes.CharsetCode);

    FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(ATranslationTableEntry->RawData));

    ATranslationTableEntry++;
    BufferLength = BufferLength - sizeof(TTranslationTableEntry);
  }

  if ((FTranslations->Count == 0) && FHasVersionInfo)
  {
    // Interestingly, there was *NO* translation
    // data stored inside the buffer - for whatever
    // reason there might be.
    // The operating system mandates a language-charset
    // identifier, though, when it comes to querying
    // for string data.
    // Resolution: create a fake entry which is
    //             language-neutral and which uses
    //             the Unicode charset.

    TTranslationTableEntry TranslationCode;
    TranslationCode.Codes.LanguageCode = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
    TranslationCode.Codes.CharsetCode = 0x04b0; // Unicode

    TempString = L"";
	TempString.sprintf(L"%.4X%.4X", TranslationCode.Codes.LanguageCode,
                                  TranslationCode.Codes.CharsetCode );

    FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(TranslationCode.RawData));
  }

  // By default pick the first language-charset entry
  // for display / analysis.
  FLanguageCharsetIndex = 0;
}
开发者ID:SkylineNando,项目名称:Delphi,代码行数:68,代码来源:VersionInfoComponent.cpp


注:本文中的UnicodeString::sprintf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。