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


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

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


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

示例1: getName

UnicodeString getName(UnicodeString str) {
 UnicodeString name = str;

 if (name.Pos(":") > 0)
   name = name.SubString(1, name.Pos(":")-1);
 UnicodeString alphabet = L"QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890_";

 while (true) {
   if (name.Length() == 0)
     break;
   UnicodeString ch = name.SubString(name.Length(), 1);
   if (alphabet.Pos(ch) > 0 && name.Length() > 0)
     break;
   name = name.SubString(1, name.Length()-1);
 }

 UnicodeString temp_name;
 while (true) {
   if (name.Length() == 0)
     break;
   UnicodeString ch = name.SubString(name.Length(), 1);
   if (alphabet.Pos(ch) > 0 && name.Length() > 0)
     temp_name = ch + temp_name;
   else
     break;
   name = name.SubString(1, name.Length()-1);
 }

 return temp_name;
}
开发者ID:sea-kg,项目名称:seakgChrysocyonParser,代码行数:30,代码来源:main.cpp

示例2: tabelaOpusa

UnicodeString tabelaOpusa(UnicodeString Tabela)
{
    if (Tabela.Pos("clienti_") == 0)
        return "clienti_"+Tabela;
    else
    {
        int pos = Tabela.Pos("_");
        return Tabela.SubString(pos+1, Tabela.Length()-pos);
    }
}
开发者ID:elfumelfu,项目名称:sandbox,代码行数:10,代码来源:tools.cpp

示例3: ReplaceStrAll

UnicodeString ReplaceStrAll(const UnicodeString & Str, const UnicodeString & What, const UnicodeString & ByWhat)
{
  UnicodeString Result = Str;
  intptr_t Pos = Result.Pos(What);
  while (Pos > 0)
  {
    Result.Replace(Pos, What.Length(), ByWhat.c_str(), ByWhat.Length());
    Pos = Result.Pos(What);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:11,代码来源:Sysutils.cpp

示例4: BookmarkFolderValidateName

//---------------------------------------------------------------------------
void __fastcall BookmarkFolderValidateName(const UnicodeString Name,
  bool AllowEmpty)
{
  if ((!AllowEmpty && Name.IsEmpty()) || Name.Pos(L"\\"))
  {
    throw Exception(FMTLOAD(BOOKMARK_FOLDER_INVALID_NAME, (Name)));
  }
}
开发者ID:elazzi,项目名称:winscp,代码行数:9,代码来源:LocationProfiles.cpp

示例5: TrimVersion

//---------------------------------------------------------------------------
UnicodeString TConfiguration::TrimVersion(const UnicodeString & Version) const
{
  UnicodeString Result = Version;
  while ((Result.Pos(L".") != Result.LastDelimiter(L".")) &&
    (Result.SubString(Result.Length() - 1, 2) == L".0"))
  {
    Result.SetLength(Result.Length() - 2);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:11,代码来源:Configuration.cpp

示例6: AnsiReplaceStr

UnicodeString AnsiReplaceStr(const UnicodeString & Str, const UnicodeString & From,
  const UnicodeString & To)
{
  UnicodeString Result = Str;
  intptr_t Pos = 0;
  while ((Pos = Result.Pos(From)) > 0)
  {
    Result.Replace(Pos, From.Length(), To);
  }
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:11,代码来源:Sysutils.cpp

示例7: FormCloseQuery

//---------------------------------------------------------------------------
void __fastcall TCustomCommandDialog::FormCloseQuery(TObject * /*Sender*/,
  bool & /*CanClose*/)
{
  if (ModalResult == DefaultResult(this))
  {
    if ((FMode == ccmAdd) || (FMode == ccmEdit))
    {
      UnicodeString Desc = DescriptionEdit->Text;

      if (Desc.Pos(L"=") > 0)
      {
        DescriptionEdit->SetFocus();
        throw Exception(FMTLOAD(CUSTOM_COMMAND_INVALID, (L"=")));
      }

      if (((FMode == ccmAdd) || ((FMode == ccmEdit) && (Desc != FOrigDescription))) &&
          (FCustomCommandList->Find(Desc) != 0))
      {
        DescriptionEdit->SetFocus();
        throw Exception(FMTLOAD(CUSTOM_COMMAND_DUPLICATE, (Desc)));
      }
    }

    try
    {
      bool RemoteCommand = RemoteCommandButton->Checked;

      TRemoteCustomCommand RemoteCustomCommand;
      TLocalCustomCommand LocalCustomCommand;
      TFileCustomCommand * FileCustomCommand =
        (RemoteCommand ? &RemoteCustomCommand : &LocalCustomCommand);

      TInteractiveCustomCommand InteractiveCustomCommand(FileCustomCommand);

      UnicodeString Command = CommandEdit->Text;
      InteractiveCustomCommand.Validate(Command);
      Command = InteractiveCustomCommand.Complete(Command, false);
      FileCustomCommand->Validate(Command);
    }
    catch(...)
    {
      CommandEdit->SetFocus();
      throw;
    }

    if (FOnValidate)
    {
      TCustomCommandType Command;
      GetCommand(Command);
      FOnValidate(Command);
    }
  }
}
开发者ID:mpmartin8080,项目名称:winscp,代码行数:54,代码来源:CustomCommand.cpp

示例8: UnMungeIniName

UnicodeString UnMungeIniName(const UnicodeString & Str)
{
  intptr_t P = Str.Pos(L"%3D");
  // make this fast for now
  if (P > 0)
  {
    return ReplaceStr(Str, L"%3D", L"=");
  }
  else
  {
    return Str;
  }
}
开发者ID:skyformat99,项目名称:Far-NetBox,代码行数:13,代码来源:HierarchicalStorage.cpp

示例9: ScanAndPrint

void ScanAndPrint(seakgOutput *pOutput, UnicodeString fullname) {
  TStringList *list = new TStringList();  
  list->LoadFromFile(fullname);
  int nCount = list->Count;
  for (int i = 0; i < nCount; i++)
  {
    UnicodeString str = list->Strings[i];
	  if (str.Pos(L"class") > 0 && str.Pos("__declspec") > 0) {
      UnicodeString code = str + "\r\n";
      str = str.Trim();

      UnicodeString uuid = "none";
      if (str.Pos("\"") > 0)
        uuid = str.SubString(str.Pos("\"") + 1, 36);

      UnicodeString interfacename = str.SubString(str.Pos("I"), str.Length() - str.Pos("I") + 1);
      UnicodeString interfacename2 = getName(str);
      bool bStop = false;
      int nIncr = 0;
      while (bStop == false && i < nCount) {
        i++;
        str = list->Strings[i];
        if (str.Pos("{") > 0) {
          nIncr++;
        };

        if (str.Pos("}") > 0) {
          nIncr--;
          if(nIncr == 0) bStop = true;
        };

        code += str + "\n";
      };

	  PrintDoc(pOutput, fullname, interfacename2, uuid, code);
//      std::wcout << str.c_str();
    };
  };



  /*std::wcout << "createuuidprojectname: " <<  << "\r\n";
  std::wcout << "projectname: " << projectName.c_str() << "\r\n";
  std::wcout << "fullname: " << fullname.c_str() << "\r\n";*/
};
开发者ID:sea-kg,项目名称:seakgChrysocyonParser,代码行数:45,代码来源:main.cpp

示例10: MatchesMaskMask

//---------------------------------------------------------------------------
bool TFileMasks::MatchesMaskMask(const TMaskMask & MaskMask, const UnicodeString & Str)
{
  bool Result;
  if (MaskMask.Kind == TMaskMask::Any)
  {
    Result = true;
  }
  else if ((MaskMask.Kind == TMaskMask::NoExt) && (Str.Pos(L".") == 0))
  {
    Result = true;
  }
  else
  {
    Result = MaskMask.Mask->Matches(Str);
  }
  return Result;
}
开发者ID:nineclock,项目名称:Far-NetBox,代码行数:18,代码来源:FileMasks.cpp

示例11: ESrvResponseError

//---------------------------------------------------------------------------
// TSrvResponse
//---------------------------------------------------------------------------
__fastcall TSrvResponse::TSrvResponse(UnicodeString ResponseText)
	: TStringList()
{
	if (ResponseText.IsEmpty()) throw ESrvResponseError(L"Server response is empty.");

	this->Text = ResponseText;
	try {
		this->StatusCode = StrToInt(this->Strings[0]);
	}
	catch (EConvertError& e) {
		throw ESrvResponseError(L"Cannot read status code. "+e.Message);
	}

	this->Delete(0); //Remove status code line

	for (int i = this->Count-1; i >= 0; i--) {
		UnicodeString line = this->Strings[i].Trim();
		int split = line.Pos(L":");
		if (split) {
			this->Strings[i] = line.SubString(1, split-1).Trim() \
			+ L":" \
			+ line.SubString(split+1, line.Length()-split).Trim();
		}
		else {
			this->Delete(i);
		}
	}

	this->NameValueSeparator = ':';

	if (this->StatusCode != 0) {
		if (this->StatusCode < 0) throw ESrvResponseError(L"Negative status code not allowed.");

		this->ErrorMessage = this->ReadString(TSrvResponseValID("ErrorMessage"), L"", true);
		if (this->ErrorMessage.IsEmpty()) this->ErrorMessage = L"Error #"
			+ IntToStr(this->StatusCode)
			+ L" (No error message provided).";
	}
	else { //Find URLs
		this->AvatarURL = this->Values[L"AvatarURL"];
		this->WatermarkURL = this->Values[L"WatermarkURL"];
    }
}
开发者ID:DesktopUpload,项目名称:DesktopUploader,代码行数:46,代码来源:SrvInfo.cpp

示例12: StartsText

//---------------------------------------------------------------------------
bool StartsText(const UnicodeString & ASubText, const UnicodeString & AText)
{
  return AText.Pos(ASubText) == 1;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:5,代码来源:Sysutils.cpp

示例13: StartsStr

bool StartsStr(const UnicodeString & SubStr, const UnicodeString & Str)
{
    return Str.Pos(SubStr) == 1;
}
开发者ID:kocicjelena,项目名称:Far-NetBox,代码行数:4,代码来源:StrUtils.cpp

示例14: AnsiPos

intptr_t AnsiPos(const UnicodeString & Str, wchar_t Ch)
{
  intptr_t Result = Str.Pos(Ch);
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:5,代码来源:Sysutils.cpp

示例15: Pos

intptr_t Pos(const UnicodeString & Str, const UnicodeString & Substr)
{
  intptr_t Result = Str.Pos(Substr.c_str());
  return Result;
}
开发者ID:CyberShadow,项目名称:Far-NetBox,代码行数:5,代码来源:Sysutils.cpp


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