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


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

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


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

示例1: FileSearch

UnicodeString FileSearch(const UnicodeString & FileName, const UnicodeString & DirectoryList)
{
  UnicodeString Temp;
  UnicodeString Result;
  Temp = DirectoryList;
  UnicodeString PathSeparators = L"/\\";
  do
  {
    intptr_t I = ::Pos(Temp, PathSeparators);
    while ((Temp.Length() > 0) && (I == 0))
    {
      Temp.Delete(1, 1);
      I = ::Pos(Temp, PathSeparators);
    }
    I = ::Pos(Temp, PathSeparators);
    if (I > 0)
    {
      Result = Temp.SubString(1, I - 1);
      Temp.Delete(1, I);
    }
    else
    {
      Result = Temp;
      Temp = L"";
    }
    Result = ::IncludeTrailingBackslash(Result);
    Result = Result + FileName;
    if (!::FileExists(Result))
    {
      Result = L"";
    }
  }
  while (!(Temp.Length() == 0) || (Result.Length() != 0));
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:35,代码来源:Sysutils.cpp

示例2: GenerateUrl

//---------------------------------------------------------------------------
UnicodeString __fastcall TGenerateUrlDialog::GenerateUrl(UnicodeString Path)
{
  UnicodeString Url =
    FData->GenerateSessionUrl(
      FLAGMASK(WinSCPSpecificCheck->Checked, sufSpecific) |
      FLAGMASK(UserNameCheck->Enabled && UserNameCheck->Checked, sufUserName) |
      FLAGMASK(PasswordCheck->Enabled && PasswordCheck->Checked, sufPassword) |
      FLAGMASK(HostKeyCheck->Enabled && HostKeyCheck->Checked, sufHostKey));

  if ((RemoteDirectoryCheck->Enabled && RemoteDirectoryCheck->Checked) ||
      (FPaths != NULL))
  {
    if (StartsStr(L"/", Path));
    {
      Path.Delete(1, 1);
    }

    Url += EncodeUrlPath(Path);
  }

  if (SaveExtensionCheck->Enabled && SaveExtensionCheck->Checked)
  {
    Url += UnicodeString(UrlParamSeparator) + UrlSaveParamName;
  }

  return Url;
}
开发者ID:thinkinnight,项目名称:winscp,代码行数:28,代码来源:GenerateUrl.cpp

示例3: SetText

//---------------------------------------------------------------------------
void __fastcall TRightsFrame::SetText(UnicodeString value)
{
  if (Text != value)
  {
    UnicodeString RightsStr = value;

    int P = RightsStr.LowerCase().Pos(FAddXToDirectoriesSuffix);
    bool AAddXToDirectories = (P > 0);
    if (AAddXToDirectories)
    {
      RightsStr.Delete(P, FAddXToDirectoriesSuffix.Length());
    }
    RightsStr = DeleteChar(DeleteChar(RightsStr, L'('), L')').Trim();
    TRights R = Rights;
    if (((RightsStr.Length() == 3) || (RightsStr.Length() == 4)) &&
        IsNumber(RightsStr))
    {
      R.Octal = RightsStr;
    }
    else
    {
      R.Text = RightsStr;
    }

    Rights = R;
    AddXToDirectories = AAddXToDirectories;
  }
}
开发者ID:mpmartin8080,项目名称:winscp,代码行数:29,代码来源:Rights.cpp

示例4: UnixExcludeLeadingBackslash

//---------------------------------------------------------------------------
UnicodeString UnixExcludeLeadingBackslash(const UnicodeString & Path)
{
  UnicodeString Result = Path;
  while (!Result.IsEmpty() && Result[1] == L'/')
  {
    Result.Delete(1, 1);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:10,代码来源:Sysutils.cpp

示例5: ExtractFileDir

bool TForm1::MakeBackup() {
	UnicodeString dir = ExtractFileDir(m_strFileName) + "\\backups";
	if (!DirectoryExists(dir) && !CreateDir(dir)) {
		return false;
	}
	UnicodeString newfilename = ExtractFileName(m_strFileName);
	newfilename.Delete(newfilename.Length() - ExtractFileExt(m_strFileName).Length() + 1, ExtractFileExt(m_strFileName).Length());

	newfilename =
		dir + L"\\" +
		newfilename + " (" + TDateTime::CurrentDateTime().FormatString("yyyy-mm-dd hh_nn") + ")" +
		ExtractFileExt(m_strFileName);
	Log->Lines->Add("Сохраняю резервную копию файла в " + newfilename);
	bool bResult = CopyFile(m_strFileName.c_str(),newfilename.c_str(),false);
	return bResult;
}
开发者ID:sea-kg,项目名称:homemoney,代码行数:16,代码来源:main.cpp

示例6: DoXmlEscape

static UnicodeString DoXmlEscape(const UnicodeString & Str, bool NewLine)
{
  UnicodeString Result = Str;
  for (intptr_t Index = 1; Index <= Result.Length(); ++Index)
  {
    const wchar_t * Repl = nullptr;
    switch (Result[Index])
    {
      case L'&':
        Repl = L"amp;";
        break;

      case L'>':
        Repl = L"gt;";
        break;

      case L'<':
        Repl = L"lt;";
        break;

      case L'"':
        Repl = L"quot;";
        break;

      case L'\n':
        if (NewLine)
        {
          Repl = L"#10;";
        }
        break;

      case L'\r':
        Result.Delete(Index, 1);
        Index--;
        break;
    }

    if (Repl != nullptr)
    {
      Result[Index] = L'&';
      Result.Insert(Repl, Index + 1);
      Index += wcslen(Repl);
    }
  }
  return Result;
}
开发者ID:gumb0,项目名称:Far-NetBox,代码行数:46,代码来源:SessionInfo.cpp

示例7: DoXmlEscape

static UnicodeString DoXmlEscape(UnicodeString AStr, bool NewLine)
{
  UnicodeString Str = AStr;
  for (intptr_t Index = 1; Index <= Str.Length(); ++Index)
  {
    const wchar_t *Repl = nullptr;
    switch (Str[Index])
    {
    case L'&':
      Repl = L"amp;";
      break;

    case L'>':
      Repl = L"gt;";
      break;

    case L'<':
      Repl = L"lt;";
      break;

    case L'"':
      Repl = L"quot;";
      break;

    case L'\n':
      if (NewLine)
      {
        Repl = L"#10;";
      }
      break;

    case L'\r':
      Str.Delete(Index, 1);
      --Index;
      break;
    }

    if (Repl != nullptr)
    {
      Str[Index] = L'&';
      Str.Insert(Repl, Index + 1);
      Index += nb::StrLength(Repl);
    }
  }
  return Str;
}
开发者ID:michaellukashov,项目名称:Far-NetBox,代码行数:46,代码来源:SessionInfo.cpp

示例8: DoXmlEscape

//---------------------------------------------------------------------------
UnicodeString __fastcall DoXmlEscape(UnicodeString Str, bool NewLine)
{
  for (int i = 1; i <= Str.Length(); i++)
  {
    const wchar_t * Repl = NULL;
    switch (Str[i])
    {
      case L'&':
        Repl = L"amp;";
        break;

      case L'>':
        Repl = L"gt;";
        break;

      case L'<':
        Repl = L"lt;";
        break;

      case L'"':
        Repl = L"quot;";
        break;

      case L'\n':
        if (NewLine)
        {
          Repl = L"#10;";
        }
        break;

      case L'\r':
        Str.Delete(i, 1);
        i--;
        break;
    }

    if (Repl != NULL)
    {
      Str[i] = L'&';
      Str.Insert(Repl, i + 1);
      i += wcslen(Repl);
    }
  }
  return Str;
}
开发者ID:seebigsea,项目名称:winscp,代码行数:46,代码来源:SessionInfo.cpp

示例9: OpenWinSCPKey

//---------------------------------------------------------------------------
static long OpenWinSCPKey(HKEY Key, const char * SubKey, HKEY * Result, bool CanCreate)
{
  long R;
  assert(Configuration != NULL);

  assert(Key == HKEY_CURRENT_USER);
  USEDPARAM(Key);

  UnicodeString RegKey = SubKey;
  int PuttyKeyLen = OriginalPuttyRegistryStorageKey.Length();
  assert(RegKey.SubString(1, PuttyKeyLen) == OriginalPuttyRegistryStorageKey);
  RegKey = RegKey.SubString(PuttyKeyLen + 1, RegKey.Length() - PuttyKeyLen);
  if (!RegKey.IsEmpty())
  {
    assert(RegKey[1] == L'\\');
    RegKey.Delete(1, 1);
  }

  if (RegKey.IsEmpty())
  {
    *Result = static_cast<HKEY>(NULL);
    R = ERROR_SUCCESS;
  }
  else
  {
    // we expect this to be called only from verify_host_key() or store_host_key()
    assert(RegKey == L"SshHostKeys");

    THierarchicalStorage * Storage = Configuration->CreateConfigStorage();
    Storage->AccessMode = (CanCreate ? smReadWrite : smRead);
    if (Storage->OpenSubKey(RegKey, CanCreate))
    {
      *Result = reinterpret_cast<HKEY>(Storage);
      R = ERROR_SUCCESS;
    }
    else
    {
      delete Storage;
      R = ERROR_CANTOPEN;
    }
  }

  return R;
}
开发者ID:elazzi,项目名称:winscp,代码行数:45,代码来源:PuttyIntf.cpp

示例10: OpenWinSCPKey

static long OpenWinSCPKey(HKEY Key, const char * SubKey, HKEY * Result, bool CanCreate)
{
  long R;
  assert(GetConfiguration() != nullptr);

  assert(Key == HKEY_CURRENT_USER);
  USEDPARAM(Key);

  UnicodeString RegKey = SubKey;
  UnicodeString OriginalPuttyRegistryStorageKey(_T(PUTTY_REG_POS));
  intptr_t PuttyKeyLen = OriginalPuttyRegistryStorageKey.Length();
  assert(RegKey.SubString(1, PuttyKeyLen) == OriginalPuttyRegistryStorageKey);
  RegKey = RegKey.SubString(PuttyKeyLen + 1, RegKey.Length() - PuttyKeyLen);
  if (!RegKey.IsEmpty())
  {
    assert(RegKey[1] == L'\\');
    RegKey.Delete(1, 1);
  }

  if (RegKey.IsEmpty())
  {
    *Result = static_cast<HKEY>(nullptr);
    R = ERROR_SUCCESS;
  }
  else
  {
    // we expect this to be called only from verify_host_key() or store_host_key()
    assert(RegKey == L"SshHostKeys");

    std::unique_ptr<THierarchicalStorage> Storage(GetConfiguration()->CreateConfigStorage());
    Storage->SetAccessMode((CanCreate ? smReadWrite : smRead));
    if (Storage->OpenSubKey(RegKey, CanCreate))
    {
      *Result = reinterpret_cast<HKEY>(Storage.release());
      R = ERROR_SUCCESS;
    }
    else
    {
      R = ERROR_CANTOPEN;
    }
  }

  return R;
}
开发者ID:valery-barysok,项目名称:Far-NetBox,代码行数:44,代码来源:PuttyIntf.cpp

示例11: StripHotkey

//---------------------------------------------------------------------------
UnicodeString StripHotkey(const UnicodeString & AText)
{
  UnicodeString Result = AText;
  intptr_t Len = Result.Length();
  intptr_t Pos = 1;
  while (Pos <= Len)
  {
    if (Result[Pos] == L'&')
    {
      Result.Delete(Pos, 1);
      Len--;
    }
    else
    {
      Pos++;
    }
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:20,代码来源:Sysutils.cpp

示例12: CreateMask

//---------------------------------------------------------------------------
void TFileMasks::CreateMask(
  const UnicodeString & MaskStr, intptr_t MaskStart, intptr_t /*MaskEnd*/, bool Include)
{
  bool Directory = false; // shut up
  TMask Mask;

  Mask.MaskStr = MaskStr;
  Mask.UserStr = MaskStr;
  Mask.FileNameMask.Kind = TMaskMask::Any;
  Mask.FileNameMask.Mask = nullptr;
  Mask.DirectoryMask.Kind = TMaskMask::Any;
  Mask.DirectoryMask.Mask = nullptr;
  Mask.HighSizeMask = TMask::None;
  Mask.LowSizeMask = TMask::None;
  Mask.HighModificationMask = TMask::None;
  Mask.LowModificationMask = TMask::None;

  wchar_t NextPartDelimiter = L'\0';
  intptr_t NextPartFrom = 1;
  while (NextPartFrom <= MaskStr.Length())
  {
    wchar_t PartDelimiter = NextPartDelimiter;
    intptr_t PartFrom = NextPartFrom;
    UnicodeString PartStr = CopyToChars(MaskStr, NextPartFrom, L"<>", false, &NextPartDelimiter, true);

    intptr_t PartStart = MaskStart + PartFrom - 1;
    intptr_t PartEnd = MaskStart + NextPartFrom - 1 - 2;

    TrimEx(PartStr, PartStart, PartEnd);

    if (PartDelimiter != L'\0')
    {
      bool Low = (PartDelimiter == L'>');

      TMask::TMaskBoundary Boundary;
      if ((PartStr.Length() >= 1) && (PartStr[1] == L'='))
      {
        Boundary = TMask::Close;
        PartStr.Delete(1, 1);
      }
      else
      {
        Boundary = TMask::Open;
      }

      TFormatSettings FormatSettings = TFormatSettings::Create(GetDefaultLCID());
      FormatSettings.DateSeparator = L'-';
      FormatSettings.TimeSeparator = L':';
      FormatSettings.ShortDateFormat = L"yyyy/mm/dd";
      FormatSettings.ShortTimeFormat = L"hh:nn:ss";

      TDateTime Modification;
      if (TryStrToDateTime(PartStr, Modification, FormatSettings) ||
          TryRelativeStrToDateTime(PartStr, Modification))
      {
        TMask::TMaskBoundary & ModificationMask =
          (Low ? Mask.LowModificationMask : Mask.HighModificationMask);

        if ((ModificationMask != TMask::None) || Directory)
        {
          // include delimiter into size part
          ThrowError(PartStart - 1, PartEnd);
        }

        ModificationMask = Boundary;
        (Low ? Mask.LowModification : Mask.HighModification) = Modification;
      }
      else
      {
        TMask::TMaskBoundary & SizeMask = (Low ? Mask.LowSizeMask : Mask.HighSizeMask);
        __int64 & Size = (Low ? Mask.LowSize : Mask.HighSize);

        if ((SizeMask != TMask::None) || Directory)
        {
          // include delimiter into size part
          ThrowError(PartStart - 1, PartEnd);
        }

        SizeMask = Boundary;
        Size = ParseSize(PartStr);
      }
    }
    else if (!PartStr.IsEmpty())
    {
      intptr_t D = PartStr.LastDelimiter(DirectoryMaskDelimiters);

      Directory = (D > 0) && (D == PartStr.Length());

      if (Directory)
      {
        do
        {
          PartStr.SetLength(PartStr.Length() - 1);
          Mask.UserStr.Delete(PartStart - MaskStart + D, 1);
          D--;
        }
        while (PartStr.IsDelimiter(DirectoryMaskDelimiters, PartStr.Length()));

        D = PartStr.LastDelimiter(DirectoryMaskDelimiters);
//.........这里部分代码省略.........
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:101,代码来源:FileMasks.cpp


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