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


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

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


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

示例1: SplitVersionNumber

void TFileVersionInfo::SplitVersionNumber()
{
	String version = Values[fviFileVersion];
	if (version.IsEmpty()) return;

	version = AnsiReplaceStr(version, ",", "."); // Seperator can be ',' or '.'.

	int pos1 = 1;
	int pos2 = version.Pos(".");
	if (!pos2) return;
	FMajor = version.SubString(pos1, pos2-pos1);
	version = version.Delete(pos1, (pos2-pos1 +1));

	pos2 = version.Pos(".");
	if (!pos2) return;
	FMinor = version.SubString(pos1, pos2-pos1);
	version = version.Delete(pos1, (pos2-pos1 +1));

	pos2 = version.Pos(".");
	if (!pos2) return;
	FRelease = version.SubString(pos1, pos2-pos1);
	version = version.Delete(pos1, (pos2-pos1 +1));

	FBuild = version;
}
开发者ID:ChakaZulu,项目名称:ecc,代码行数:25,代码来源:eccFileVersionInfo.cpp

示例2: CheckAndCorrectName

/**
*  @brief
*    Checks and corrects names
*/
void PLSceneContainer::CheckAndCorrectName(String &sName, const TCHAR szMaxNode[], const char szType[]) const
{
	// Check for empty name
	if (!sName.GetLength()) {
		g_pLog->LogFLine(PLLog::Warning, "'%s': There's no %s name!", szMaxNode, szType);

		// Set a dummy name
		sName = "?";

	// Check for spaces/tabs within the name
	} else if (sName.IndexOf(" ") >= 0 || sName.IndexOf("	") >= 0) {
		if (g_SEOptions.bRemoveSpaces) {
			const String sOldName = sName;

			// Remove all spaces
			int i = sName.IndexOf(" ");
			while (i >= 0) {
				sName.Delete(i, 1);
				i = sName.IndexOf(" ");
			}

			// Remove all tabs
			i = sName.IndexOf("	");
			while (i >= 0) {
				sName.Delete(i, 1);
				i = sName.IndexOf("	");
			}

			// Log message
			g_pLog->LogFLine(PLLog::Warning, "'%s': There are spaces/tabs within the %s name '%s', this is NOT recommended! Changed name into '%s' automatically.", szMaxNode, szType, sOldName.GetASCII(), sName.GetASCII());
		} else {
			g_pLog->LogFLine(PLLog::Warning, "'%s': There are spaces/tabs within the %s name '%s', this is NOT recommended!", szMaxNode, szType, sName.GetASCII());
		}
	}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:39,代码来源:PLSceneContainer.cpp

示例3: Error

void PixInsightX11Installer::CopyFiles( const String& targetDir, const String& sourceDir )
{
   if ( !targetDir.BeginsWith( '/' ) )
      throw Error( "CopyFiles(): Relative target directory." );
   if ( !sourceDir.BeginsWith( '/' ) )
      throw Error( "CopyFiles(): Relative source directory." );
   if ( targetDir.EndsWith( '/' ) || sourceDir.EndsWith( '/' ) )
      throw Error( "CopyFiles(): Incorrectly terminated directories." );
   if ( !File::DirectoryExists( targetDir ) )
      throw Error( "CopyFiles(): Nonexistent target directory." );
   if ( !File::DirectoryExists( sourceDir ) )
      throw Error( "CopyFiles(): Nonexistent source directory." );

   StringList sourceItems = SearchDirectory( sourceDir );

   size_type sourceDirLen = sourceDir.Length();
   for ( StringList::const_iterator i = sourceItems.Begin(); i != sourceItems.End(); ++i )
   {
      String relSourcePath = *i;
      relSourcePath.DeleteLeft( sourceDirLen );

      String targetPath = targetDir + relSourcePath;
      if ( targetPath.EndsWith( '/' ) )
      {
         /*
          * Create a subdirectory
          */
         targetPath.Delete( targetPath.UpperBound() );
         if ( !File::DirectoryExists( targetPath ) )
         {
            File::CreateDirectory( targetPath );
            String sourcePath = *i;
            sourcePath.Delete( sourcePath.UpperBound() );
            File::CopyTimesAndPermissions( targetPath, sourcePath );
         }
      }
      else
      {
         /*
          * Copy a file
          */
         /*
          * ### N.B. We don't have to create subdirectories here becase they
          * have been reported by SearchDirectory(), and we are creating them
          * before copying files. SearchDirectory() promises that all
          * subdirectories are reported before their contained files.
          */
         /*
         String targetSubdir = File::ExtractDirectory( targetPath );
         if ( targetSubdir.EndsWith( '/' ) )
            targetSubdir.Delete( targetSubdir.UpperBound() );
         if ( !File::DirectoryExists( targetSubdir ) )
            File::CreateDirectory( targetSubdir );
         */
         File::CopyFile( targetPath, *i );
      }
   }
}
开发者ID:morserover,项目名称:PCL,代码行数:58,代码来源:installer.cpp

示例4: TrimChars

String TrimChars(const String Source, Char ALeadingChar, Char ATrailingChar)
{
  String Result = Source;
  if ((Result != "") && (ALeadingChar != 0))
    while (Result[1] == ALeadingChar)
      Result.Delete(1, 1);

  if ((Result != "") && (ATrailingChar != 0))
    while (Result[Result.Length()] == ATrailingChar)
      Result.Delete(Result.Length(), 1);
  return Result;
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:12,代码来源:Main.cpp

示例5: SchoolCodeMaskEditChange

void __fastcall TMainForm::SchoolCodeMaskEditChange(TObject *Sender)
{
	String chars = "0123456789";
	TMaskEdit *me = (TMaskEdit*)Sender;
	char *c;
	int i, carPos;
	String s = me->Text;

	carPos = me->SelStart;
	for (i = 1; i <= s.Length(); i++) {
		if (!chars.Pos(s[i]))	{
			s.Delete(i, 1);
			carPos--;
			Beep();
		}
	}

	if (s.Length() > 6)	{
		s = s.SubString(1, 6);
		Beep();
	}
	me->Text = s;
	me->SelStart = carPos;

//	c =

}
开发者ID:IshPeredysh,项目名称:udd2,代码行数:27,代码来源:MainUnit.cpp

示例6: Change_State

void TLevWrt::Change_State(TPanel *obj, String s, TColor col)
{
 if (obj->Caption.Pos(compPanelLab) != NULL)
 {
  String s = obj->Caption;
  String dest;
  for (int i = s.Length(); i > 0; i--)
  {
   if (s[i] != 'p') dest.Insert(s[i], 0);
   else break;
  }
   TComponent* comp = Application->FindComponent(compObjType + IntToStr(StrToInt(dest) + cm));
   comp->Free();
   comp = Application->FindComponent(compFilePath + IntToStr(StrToInt(dest) + cm));
   comp->Free();
   comp = Application->FindComponent("OpnDlg" + IntToStr(StrToInt(dest) + cm));
   comp->Free();
 }
 String line = s.Delete(s.Pos("&"), 1);
 obj->Caption = line;
 obj->Hint = line;
 obj->Color = col;
 obj->Font->Color = clBlack;
 modified = true;
}
开发者ID:yurembo,项目名称:XMLLevelWriter,代码行数:25,代码来源:main.cpp

示例7: LocalizeMenuItem

 bool LocalizeMenuItem(TMenuItem* sControl,int Mode,IDCMapLocalStrings* Strs)
 {
	if(!Strs)Strs = g_pLocalStrings;

	dcmapWCSTR wstr;

	String Name = sControl->Name;

	if(Mode==0)
	{
		 Strs->SelectSection("Menues");
		 int len = Name.Length();
		 Name.Delete(len-3,len);
	}

	if(!sControl->SubMenuImages)
		sControl->SubMenuImages = InterfaceModule->MenuImageList;

	wstr = Strs->GetSectionStringW(WideToString(Name).c_str());
	if(wstr[0])sControl->Caption = wstr;

	wstr = Strs->GetSectionStringW(WideToString(Name+".Hint").c_str());
	if(wstr[0])sControl->Hint = wstr;

	wstr = Strs->GetSectionStringW(WideToString(Name+".Shortcut").c_str());
	if(wstr[0])sControl->ShortCut = TextToShortCut(wstr);
	wstr = Strs->GetSectionStringW(WideToString(Name+".Glyph").c_str());
	if(wstr[0])
	{
		sControl->ImageIndex = InterfaceModule->GetMenuImage(wstr);
	}
	return true;

 }
开发者ID:JlblC,项目名称:dcmap,代码行数:34,代码来源:Localize.cpp

示例8: GetAngelScriptFunctionDeclaration

/**
*  @brief
*    Gets a AngelScript function declaration
*/
String Script::GetAngelScriptFunctionDeclaration(const String &sFunctionName, const String &sFunctionSignature, bool bCppToAngelScript) const
{
	// Start with the PixelLight function signature (e.g. "void(int,float)")
	String sFunctionDeclaration = sFunctionSignature;

	// Find the index of the "("
	int nIndex = sFunctionDeclaration.IndexOf("(");
	if (nIndex > -1) {

		// [HACK] AngelScript really don't like something like "string MyFunction(string)", it want's "string @MyFunction(const string &)"!
		// I assume that "@" means "AngelScript, take over the control of the given memory". I wasn't able to find the documentation about
		// the AngelScript function declaration syntax, just "scriptstring.cpp" as example.
		if (bCppToAngelScript && sFunctionDeclaration.IndexOf("string") > -1) {
			String sParameters = sFunctionDeclaration.GetSubstring(nIndex);	// Find the parameters part in the string
			sParameters.Replace("string", "const string &");				// Change parameters
			sFunctionDeclaration.Delete(nIndex);							// Remove parameters from original function declaration
			sFunctionDeclaration.Replace("string", "string @");				// Change return
			sFunctionDeclaration += sParameters;							// Construct new function declaration
			nIndex = sFunctionDeclaration.IndexOf("(");						// Update the "(" index
		}

		// Create the AngelScript function declaration (e.g. "void MyFunction(int,float)")
		sFunctionDeclaration.Insert(' ' + sFunctionName, nIndex);
	}

	// Return the AngelScript function declaration (e.g. "void MyFunction(int,float)")
	return sFunctionDeclaration;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:32,代码来源:Script.cpp

示例9: Init

/*********************************************************************\
	Function name    : CLanguageList::Init
	Description      :
	Created at       : 26.09.01, @ 16:11:23
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CLanguageList::Init()
{
	Filename resourcepath = GeGetStartupPath() + Filename("resource");

	if (GetC4DVersion() >= 16000) {
		// R16 has a new resource directory structure. The c4d_language.str
		// files we are searching for are in resource/modules/c4dplugin/strings_xx.
		// Fix for https://github.com/nr-plugins/resedit/issues/4
		resourcepath = resourcepath + "modules" + "c4dplugin";
	}

	AutoAlloc <BrowseFiles> pBrowse;
	pBrowse->Init(resourcepath, false);

	while (pBrowse->GetNext())
	{
		if (pBrowse->IsDir())
		{
			Filename fn = pBrowse->GetFilename();
			if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
			{
				String idx = fn.GetString();
				idx.Delete(0, 8);

				Filename stringname = resourcepath + fn+Filename("c4d_language.str");
				AutoAlloc <BaseFile> pFile;
				if (!pFile)
					return;
				if (!GeFExist(stringname))
				{
					GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
				}
				else if (pFile->Open(stringname))
				{
					Int32 len = pFile->GetLength();
					Char *buffer = NewMemClear(Char,len + 2);
					if (buffer)
					{
						pFile->ReadBytes(buffer,len);
						buffer[len]=0;

						Int32 i;

						for (i = 0; i < len && buffer[i] >= ' '; i++) { }
						buffer[i] = 0;

						for (i--; i > 0 && buffer[i]== ' '; i--) { }
						buffer[i + 1] = 0;

						AddLanguage(buffer, idx);
						DeleteMem(buffer);
					}
				}
			}
		}
	}

	CriticalAssert(GetNumLanguages() > 0);
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:66,代码来源:LanguageList.cpp

示例10: GetClassNamesValues

String TPropertyHandler::GetClassNamesValues(TComponent* comp, String prName)
{
	TObject *subObj = (TObject *)GetOrdProp(comp, prName);
	if (subObj == NULL) return ""; // In case the prop-value is empty (like Action).

/*  TObject* subObj is needed to find out if the subprop points to
	another Component (like ActiveControl).
	If it is only the value of that property is returned (ie.: "CheckBox1").
	If it is a class like Font all of the props+values of
	comp->Font are returned. */

	if (dynamic_cast<TComponent*>(subObj))
	{   // Find out if subObj points to another Component by casting.
		return prName + "=" + GetValue((TComponent*)subObj,"Name");
	}

/*  subObj does not point to another Component, but we can convert
	it to a TComponent* subComp so it can be used te get the subProps+values.
	This sounds weird but don't forget that a TFont encapsulated in a TForm
	becomes a descendant of TForm, which is a descendant of TComponent!! */

	TComponent* subComp = (TComponent*)subObj;

	TStringList *tempList = new TStringList;
	String temp;
	try
	{
		PTypeInfo TypeInfo = (PTypeInfo)subComp->ClassInfo();
		PPropInfo* PropList = new TPropList;
		GetPropInfos(TypeInfo, (PPropList)PropList);

		tempList->Sorted = true;
		for (int i=0; i < PropertyCount(subComp); i++)
		{
			String subProp = String(PropList[i]->Name);
			tempList->Add(
				prName + "." + subProp
				+ "=" + GetPropValue(subComp, subProp, true) );
		}

		delete[] PropList;

		temp = tempList->Text;
		// Remove trailing carriage-returns:
		int cr = temp.LastDelimiter("\r");
		if (cr) temp.Delete(cr, 2);
	}
	__finally
	{
		delete tempList;
	}

	return temp;
}
开发者ID:ChakaZulu,项目名称:ecc,代码行数:54,代码来源:eccPropertyHandler.cpp

示例11: ReplaceString

String& __stdcall ReplaceString ( String& text, const char* replaceme, const char* newword )
{
	if ( !text.IsEmpty() && replaceme != NULL) {
		int i = 0;
		while (( i = text.Find(replaceme, i)) != -1 ) {
			text.Delete(i,lstrlenA(replaceme));
			text.Insert(i, newword);
			i = i + lstrlenA(newword);
	}	}

	return text;
}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:12,代码来源:tools.cpp

示例12: UpdateComponentName

String UpdateComponentName(String name) {
	int pos = PosEx("_", name, 1);

	name[1] = UpperCase(name[1])[1];
	while (pos != 0) {
		name[pos + 1] = UpperCase(name[pos + 1])[1];
        name.Delete(pos, 1);
		pos = PosEx("_", name, pos);
	}

	return name;
}
开发者ID:PaulAnnekov,项目名称:commfort-webchat,代码行数:12,代码来源:l18n.cpp

示例13: ReadString

//---------------------------------------------------------------------------
String TMYIniFile::ReadString(String Section, String Ident, char * def)
{
  int i = Find(Section.c_str(), Ident.c_str());
  if( i<0 )
		return String(def);

  String s = list->Strings[i];
  i = s.Pos("=");
  if( i==0 ) // = not found
		return String(def);
	// found
	return s.Delete(1, i).TrimLeft();
}
开发者ID:MaxBelkov,项目名称:visualsyslog,代码行数:14,代码来源:inif.cpp

示例14: Init

/*********************************************************************\
	Function name    : CLanguageList::Init
	Description      :
	Created at       : 26.09.01, @ 16:11:23
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CLanguageList::Init()
{
	Filename resourcepath = GeGetStartupPath() + Filename("resource");
	AutoAlloc <BrowseFiles> pBrowse;
	pBrowse->Init(resourcepath, false);

	while (pBrowse->GetNext())
	{
		if (pBrowse->IsDir())
		{
			Filename fn = pBrowse->GetFilename();
			if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
			{
				String idx = fn.GetString();
				idx.Delete(0, 8);

				Filename stringname = resourcepath + fn+Filename("c4d_language.str");
				AutoAlloc <BaseFile> pFile;
				if (!pFile)
					return;
				if (!GeFExist(stringname))
				{
					GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
				}
				else if (pFile->Open(stringname))
				{
					Int32 len = pFile->GetLength();
					Char *buffer = NewMemClear(Char,len + 2);
					if (buffer)
					{
						pFile->ReadBytes(buffer,len);
						buffer[len]=0;

						Int32 i;

						for (i = 0; i < len && buffer[i] >= ' '; i++) { }
						buffer[i] = 0;

						for (i--; i > 0 && buffer[i]== ' '; i--) { }
						buffer[i + 1] = 0;

						AddLanguage(buffer, idx);
						DeleteMem(buffer);
					}
				}
			}
		}
	}
}
开发者ID:phohale,项目名称:ResEdit,代码行数:56,代码来源:LanguageList.cpp

示例15: QryStock

//----------------------------------------------------------------------
int __fastcall TCotTest::QryStock(String Capital,String SecuID,int &YE,int &KYS,int &MRDJS,int &MCDJS)
{
  TBourse bourse;

  if(SecuID[1]=='H') { bourse = bsSH; }
  else { bourse = bsSZ; }

  TStockRec *stockRec = FindStock(Capital,bourse,SecuID.Delete(1,1));
  if(stockRec) {
    YE    = stockRec->Balance;
    KYS   = stockRec->Available;
    MRDJS = stockRec->BuyFreeze;
    MCDJS = stockRec->SellFreeze;
  }
  else { return -1; }

  return 0;
}
开发者ID:code4hunter,项目名称:oldpts,代码行数:19,代码来源:UCotTest.cpp


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