striremove.cpp

来自「hl2 source code. Do not use it illegal.」· C++ 代码 · 共 34 行

CPP
34
字号
/*----------------------------------------------------------------------
Copyright (c) 1998,1999 Gipsysoft. All Rights Reserved.
Please see the file "licence.txt" for licencing details.
File:	strremove.cpp
Owner:	russf@gipsysoft.com
Purpose:	remove a substring from a larger string.
					Search is case insensitive

					See strremove for a case sensitive version
----------------------------------------------------------------------*/
#include "stdafx.h"

//	Resuse function.
extern LPTSTR stristr( LPTSTR pszSource, LPCTSTR pcszSearch );

extern bool striremove( LPTSTR pszString, LPCTSTR pcszSub );

bool striremove( LPTSTR pszString, LPCTSTR pcszSub )
//
//	Return true if any of pcszSub that have been removed from
//	our main string.
{
	bool bRetVal = false;
	LPTSTR pszSubFound;
	const int nSearchLength = _tcslen( pcszSub );
	while( ( pszSubFound = stristr( pszString, pcszSub ) ) != NULL )
	{
		_tcscpy( pszSubFound, pszSubFound + nSearchLength );
		pszString = pszSubFound;
		bRetVal = true;
	}
	return bRetVal;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?