亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stringex.cpp

?? evc 簡單的錄音程序,可以檢測聲音驅動
?? CPP
字號:
//-------------------------------------------------------------------------------------------------
//
//	IBSL Technologies (c) 2000
//	BrainTree Development Ltd(c) 2000
//
//	Rennie Bowe
//	P J Tewkesbury
//
//-------------------------------------------------------------------------------------------------
//
// StringEx.cpp
//

#include "stdafx.h"
#include "StringEx.h"

CStringEx& CStringEx::Append(CString Fmt,...)
{
	va_list args;
	va_start(args, Fmt);
	CString str;
	str.FormatV(Fmt, args);
	return Insert(GetLength(), str);
}

// Insert	- Inserts a sub string into the string
// Returns	- Reference to the same string object
// pos		- Position to insert at. Extends the string with spaces if needed
// s		- Sub string to insert
CStringEx& CStringEx::Insert(int pos, LPCTSTR s)
{
	int len = lstrlen(s);
	if ( len == 0 )
		return *this;

	int oldlen = GetLength();
	int newlen = oldlen + len;
	LPTSTR str;
	if ( pos >= oldlen ) 
	{			
		// insert after end of string
		newlen += pos - oldlen ;
		str = GetBuffer( newlen );
		_tcsnset( str+oldlen, _T(' '), pos-oldlen );
		_tcsncpy( str+pos, s, len );
	} 
	else 
	{	
		// normal insert
		str = GetBuffer( newlen );
		memmove( str+pos+len, str+pos, sizeof(_T(' ')) *(oldlen-pos) );
		_tcsncpy( str+pos, s, len );
	}
	ReleaseBuffer( newlen );

	return *this;
}


// Insert	- Inserts a character into the string
// Returns	- Reference to the same string object
// pos		- Position to insert at. Extends the string with spaces if needed
// c		- Char to insert
CStringEx& CStringEx::Insert(int pos, TCHAR c)
{
	TCHAR buf[2];
	buf[0] = c;
	buf[1] = _T('\0');
	return Insert( pos, buf );
}


// Delete	- Deletes a segment of the string and resizes it
// Returns	- Reference to the same string object
// pos		- Position of the string segment to remove
// len		- Number of characters to remove
CStringEx& CStringEx::Delete(int pos, int len)
{
	int strLen = GetLength();

	if( pos >= strLen)
		return *this;
	if(len < 0 ||len > strLen - pos)
		len = strLen - pos;

	LPTSTR str = GetBuffer( strLen );
	memmove(str+pos, str+pos+len, sizeof(_T(' ')) *(strLen-pos));
	ReleaseBuffer( strLen - len );

	return *this;
}


// Replace	- Replaces a substring with another
// Returns	- Reference to the same string object
// pos		- Position of the substring
// len		- Length of substring to be replaced
// s		- New substring
CStringEx& CStringEx::Replace(int pos, int len, LPCTSTR s)
{
	Delete(pos, len);
	Insert(pos, s);

	return *this;
}

CStringEx& CStringEx::ReplaceAll(LPCTSTR s1, LPCTSTR s2)
{
	int idx;
	int pos=0;
	do
	{
		idx=Find(s1,pos);
		if (idx!=-1)
		{
			Replace(idx,_tcslen(s1),s2);			
		}
		pos=idx+_tcslen(s2);
	}
	while (idx!=-1);
	return *this;
}


// Find 	- Finds the position of a character in a string
// Returns	- A zero-based index
// ch		- Character to look for
// startpos	- Position to start looking from
int CStringEx::Find( TCHAR ch, int startpos /*= 0*/ ) const
{
	return CString::Find(ch,startpos);
}


// Find 	- Finds the position of a substring in a string
// Returns	- A zero-based index
// lpszSub	- Substring to look for
// startpos	- Position to start looking from
int CStringEx::Find( LPCTSTR lpszSub, int startpos /*= 0*/ ) const
{
	return CString::Find(lpszSub,startpos);	
}

// FindNoCase	- Case insensitive find
// Returns	- A zero-based index
// ch		- Char to search for
// startpos 	- Position to start looking from
int CStringEx::FindNoCase( TCHAR ch, int startpos /*= 0*/ ) const
{	
	unsigned int locase = Find( tolower( ch ), startpos );
	unsigned int upcase = Find( toupper( ch ), startpos );
	return locase < upcase ? locase : upcase;
}


// FindNoCase	- Case insensitive find
// Returns	- A zero-based index
// lpszSub	- Substring to search for
// startpos 	- Position to start looking from
int CStringEx::FindNoCase( LPCTSTR lpszSub, int startpos /*= 0*/ ) const
{
	CStringEx sLowerThis = *this;
	sLowerThis.MakeLower();

	CStringEx sLowerSub = lpszSub;
	sLowerSub.MakeLower();

	return sLowerThis.Find( sLowerSub, startpos );
}


// FindReplace		- Find a substring and replace with another
// Returns		- Number of instances replaced
// lpszSub		- Substring to look for
// lpszReplaceWith	- Substring to replace with
// bGlobal		- Flag to indicate whether all occurances 
//					  should be replaced
int CStringEx::FindReplace( LPCTSTR lpszSub, LPCTSTR lpszReplaceWith, 
					BOOL bGlobal /*= TRUE*/ )
{
	int iReplaced = 0;

	// find first matching substring
	LPTSTR lpsz;
	LPTSTR lpszString=GetBuffer(GetLength());
	
	int pos = 0;
	int lenSub = lstrlen( lpszSub );
	int lenReplaceWith = lstrlen( lpszReplaceWith );
	while( (lpsz = _tcsstr(&lpszString[pos], lpszSub)) != NULL )
	{
		pos = (int)(lpsz - lpszString);
		Replace( pos, lenSub, lpszReplaceWith );
		pos += lenReplaceWith;
		iReplaced++;
		if( !bGlobal ) break;
	}

	return iReplaced;
}


// FindReplaceNoCase	- Find a substring and replace with another
//			  Does case insensitive search
// Returns		- Number of instances replaced
// lpszSub		- Substring to look for
// lpszReplaceWith	- Substring to replace with
// bGlobal		- Flag to indicate whether all occurances 
//			  should be replaced
int CStringEx::FindReplaceNoCase( LPCTSTR lpszSub, LPCTSTR lpszReplaceWith, 
					 BOOL bGlobal /*= TRUE*/ )
{
	int lenSub = _tcslen( lpszSub );
	int pos=0;
	int idx=-1;
	int Count=0;
	do
	{
		idx=FindNoCase(lpszSub,pos);
		if (idx!=-1)
		{
			Replace(idx,lenSub,lpszReplaceWith);
			Count++;
			pos=idx;
		}
		pos++;
	}
	while (idx!=-1);
	return Count;

#if 0
	CStringEx sLowerThis(*this);
	sLowerThis.MakeLower();

	CStringEx sLowerSub(lpszSub);
	sLowerSub.MakeLower();

	int iReplaced = 0;

	int len=GetLength();
	LPTSTR lpszString=GetBuffer(len);

	// find first matching substring
	LPTSTR lpsz;	
	int pos = 0, offset = 0;
	int lenSub = lstrlen( lpszSub );
	int lenReplaceWith = lstrlen( lpszReplaceWith );
	
	while( (lpsz = _tcsstr((LPCTSTR)lpszLower[pos], lpszLower)) != NULL )
	{		
		pos = (int)(lpsz - lpszLower);
		Replace( pos+offset, lenSub, lpszReplaceWith );
		offset += lenReplaceWith - lenSub;
		pos += lenSub;
		iReplaced++;
		if( !bGlobal ) break;
	}

	return iReplaced;
#endif
}

// ReverseFind	- Searches for the last match of a substring
// Returns	- A zero-based index
// lpszSub	- Substring to search for
// startpos 	- Position to start looking from, in reverse dir
int CStringEx::ReverseFind( LPCTSTR lpszSub, int startpos /*= -1*/ ) 
{	
	LPTSTR lpszString=GetBuffer(GetLength());	
	int lenSub = lstrlen( lpszSub );
	int len = GetLength();

	if(0 < lenSub && 0 < len)
	{
		if( startpos == -1 || startpos >= len ) startpos = len - 1;
		for ( LPTSTR lpszReverse = &lpszString[startpos] ; 
						lpszReverse != lpszString; --lpszReverse)
			if (_tcsncmp(lpszSub, lpszReverse, lenSub ) == 0)
				return (lpszReverse - lpszString);
	}
	return -1;
}


// ReverseFindNoCase	- Searches for the last match of a substring
//			  Search is case insensitive
// Returns		- A zero-based index
// lpszSub		- Character to search for
// startpos 		- Position to start looking from, in reverse dir
int CStringEx::ReverseFindNoCase(TCHAR ch, int startpos /*= -1*/ ) 
{
	TCHAR a[2];
	a[0] = ch;
	a[1] = 0;
	return ReverseFindNoCase( a, startpos );
}

// ReverseFindNoCase	- Searches for the last match of a substring
//			  Search is case insensitive
// Returns		- A zero-based index
// lpszSub		- Substring to search for
// startpos 		- Position to start looking from, in reverse dir
int CStringEx::ReverseFindNoCase( LPCTSTR lpszSub, int startpos /*= -1*/ )
{	
	int len = GetLength();	
	LPTSTR lpszString=GetBuffer(GetLength());	
	int lenSub = lstrlen( lpszSub );

	if(0 < lenSub && 0 < len)
	{
		if( startpos == -1 || startpos >= len ) startpos = len - 1;
		for ( LPTSTR lpszReverse = &lpszString[startpos];
				lpszReverse >= lpszString; --lpszReverse)
			if (_tcsnicmp(lpszSub, lpszReverse, lenSub ) == 0)
				return (lpszReverse - lpszString);
	}
	return -1;
}


// GetField 	- Gets a delimited field
// Returns	- A CStringEx object that contains a copy of 
//		  the specified field
// delim	- The delimiter string
// fieldnum 	- The field index - zero is the first
// NOTE 	- Returns the whole string for field zero
//		  if delim not found
//		  Returns empty string if # of delim found
//		  is less than fieldnum
CStringEx CStringEx::GetField( LPCTSTR delim, int fieldnum)
{
	LPTSTR lpsz, lpszRemainder = GetBuffer(GetLength()), lpszret;
	int retlen, lenDelim = lstrlen( delim );

	while( fieldnum-- >= 0 )
	{
		lpszret = lpszRemainder;
		lpsz = _tcsstr(lpszRemainder, delim);
		if( lpsz )
		{
			// We did find the delim
			retlen = lpsz - lpszRemainder;
			lpszRemainder = lpsz + lenDelim;
		}
		else
		{
			retlen = lstrlen( lpszRemainder );
			lpszRemainder += retlen;	// change to empty string
		}
	}
	return Mid( lpszret - GetBuffer(GetLength()), retlen );
}

// GetField 	- Gets a delimited field
// Returns	- A CStringEx object that contains a copy of 
//		  the specified field
// delim	- The delimiter char
// fieldnum 	- The field index - zero is the first
// NOTE 	- Returns the whole string for field zero
//		  if delim not found
//		  Returns empty string if # of delim found
//		  is less than fieldnum
CStringEx CStringEx::GetField( TCHAR delim, int fieldnum)
{
	LPTSTR lpsz, lpszRemainder = GetBuffer(GetLength()), lpszret;
	int retlen;

	while( fieldnum-- >= 0 )
	{
		lpszret = lpszRemainder;
		lpsz = _tcschr(lpszRemainder, (_TUCHAR)delim);
		if( lpsz )
		{
			// We did find the delim
			retlen = lpsz - lpszRemainder;
			lpszRemainder = lpsz + 1;
		}
		else
		{
			retlen = lstrlen( lpszRemainder );
			lpszRemainder += retlen;	// change to empty string
		}
	}
	return Mid( lpszret - GetBuffer(GetLength()), retlen );
}


// GetFieldCount	- Get number of fields in a string
// Returns		- The number of fields
//			  Is always greater than zero
// delim		- The delimiter character
int CStringEx::GetFieldCount( TCHAR delim )
{
	TCHAR a[2];
	a[0] = delim;
	a[1] = 0;
	return GetFieldCount( a );
}


// GetFieldCount	- Get number of fields in a string
// Returns		- The number of fields
//			  Is always greater than zero
// delim		- The delimiter string
int CStringEx::GetFieldCount( LPCTSTR delim )
{	
	LPTSTR lpsz, lpszRemainder = GetBuffer(GetLength());
	int lenDelim = lstrlen( delim );

	int iCount = 1;
	while( (lpsz = _tcsstr(lpszRemainder, delim)) != NULL )
	{
		lpszRemainder = lpsz + lenDelim;
		iCount++;
	}

	return iCount;
}


// GetDelimitedField	- Finds a field delimited on both ends
// Returns		- A CStringEx object that contains a copy of 
//			  the specified field
// delimStart		- Delimiter at the start of the field
// delimEnd 		- Delimiter at the end of the field
CStringEx CStringEx::GetDelimitedField( LPCTSTR delimStart, LPCTSTR delimEnd, int fieldnum /*= 0*/)
{
	LPTSTR lpsz, lpszEnd, lpszRet, lpszRemainder = GetBuffer(GetLength());
	int lenDelimStart = lstrlen( delimStart ), lenDelimEnd = lstrlen( delimEnd );

	while( fieldnum-- >= 0 )
	{
		lpsz = _tcsstr(lpszRemainder, delimStart);
		if( lpsz )
		{
			// We did find the Start delim
			lpszRet = lpszRemainder = lpsz + lenDelimStart;
			lpszEnd = _tcsstr(lpszRemainder, delimEnd);
			if( lpszEnd == NULL ) return"";
			lpszRemainder = lpsz + lenDelimEnd;
		}
		else return "";
	}
	return Mid( lpszRet - (LPCTSTR)this, lpszEnd - lpszRet );
}

CStringEx::CStringEx(DWORD SystemErrorCode)
{
	// Init();

	LPVOID lpMsgBuf;
	::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		SystemErrorCode,
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
		(LPTSTR) &lpMsgBuf,
		0,
		NULL );
	Format(_T("%s"),lpMsgBuf);
	LocalFree( lpMsgBuf );
};

CStringEx::CStringEx(TCHAR *szFormat, ... ) 
{ 	
	// Init();
	va_list argList;
	va_start( argList, szFormat );
	FormatV( szFormat, argList );
};

CStringEx::CStringEx(UINT nResID)	// Load string with Resource String
{ 		
//	Init();
	VERIFY(LoadString(nResID) != 0);
//	_ASSERTE( m_pchData );
};

void CStringEx::operator () (UINT nResID)	// CString Name; Name(nID);
{	
	// Init();
	VERIFY(LoadString(nResID) != 0);
	// _ASSERTE( m_pchData );
};

void CStringEx::StripFormatChars()
{
	RemoveAll(10);
	RemoveAll(13);
	RemoveAll(9);	
}

CStringEx CStringEx::RemoveAll(TCHAR c) const
{
	CStringEx hilf = *this;

	while (hilf.Find(c) >= 0)	hilf = hilf.Remove(c);
	return hilf;
}

CStringEx CStringEx::Remove(TCHAR c) const
{
	int i = Find(c);

	if (i >= 0)	return Left(i) + Mid(i+1);
	else		return *this;
}

CStringEx CStringEx::Remove(const CStringEx& s) const
{
	int i = Find(s);

	if (i >= 0)	return Left(i) + Mid(i + s.GetLength());
	else		return *this;
}

CStringEx CStringEx::RemoveAll(const CStringEx& s) const
{
	CStringEx hilf = *this;

	while (hilf.Find(s) >= 0)	hilf = hilf.Remove(s);
	return hilf;
}

int CStringEx::CountChar(TCHAR ch)
{
	int Count=0;
	int idx=-1;
	do
	{
		idx=Find(ch,idx+1);
		if (idx!=-1) Count++;
	}
	while (idx!=-1);

	return Count;
}

void CStringEx::RemoveExtraSpaces()
{
	CString Temp;	
	BOOL bFirst=true;
	for(int i=0;i<GetLength();i++)
	{
		if (GetAt(i)!=' ') 
		{
			Temp+=GetAt(i);
			bFirst=true;
		}
		else 
		{
			if (bFirst)
			{
				Temp+=GetAt(i);
			}
			bFirst=false;
		}
	}
	Format(_T("%s"),Temp);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲图片欧美视频| 波多野结衣欧美| 粉嫩一区二区三区在线看| 色综合色狠狠综合色| 日韩欧美一区在线| 一区二区三区四区av| 国产在线一区观看| 88在线观看91蜜桃国自产| 国产精品久久久久aaaa| 久久国产尿小便嘘嘘| 欧美日韩成人高清| 亚洲欧美视频一区| 粉嫩av亚洲一区二区图片| 91精品婷婷国产综合久久竹菊| 亚洲私人黄色宅男| 成人免费看的视频| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲国产日韩综合久久精品| av激情综合网| 国产精品国产三级国产aⅴ无密码| 狠狠色综合播放一区二区| 91精品国产综合久久久久久久 | 亚洲va国产天堂va久久en| 不卡电影免费在线播放一区| 久久视频一区二区| 另类的小说在线视频另类成人小视频在线 | 国产精品一区二区在线看| 欧美一区二区福利视频| 日韩精品电影一区亚洲| 欧美色老头old∨ideo| 玉足女爽爽91| 日本高清无吗v一区| 亚洲欧美区自拍先锋| 成人黄色a**站在线观看| 欧美激情一区在线观看| 国产成人精品三级麻豆| 欧美国产乱子伦 | 亚洲综合在线免费观看| 色偷偷一区二区三区| 综合欧美亚洲日本| 91在线观看地址| 亚洲人成小说网站色在线| 91丝袜美女网| 亚洲电影一级片| 69久久99精品久久久久婷婷| 奇米色一区二区| www激情久久| 成人av电影在线观看| 日韩伦理av电影| 欧美无人高清视频在线观看| 日韩av电影天堂| 欧美精品一区二区三区在线播放| 国模娜娜一区二区三区| 国产精品久久久久影视| 欧美亚洲国产一区二区三区va| 日韩精品三区四区| 久久这里只有精品6| 国产91对白在线观看九色| 亚洲日本在线观看| 欧美久久久久久蜜桃| 国产综合色产在线精品| 国产精品久久久久久亚洲伦 | 国产高清一区日本| 亚洲人吸女人奶水| 欧美一区二区在线观看| 懂色av中文字幕一区二区三区 | 九九精品视频在线看| 欧美sm极限捆绑bd| 99精品国产视频| 日韩av电影免费观看高清完整版在线观看| 精品国产91久久久久久久妲己| 成人夜色视频网站在线观看| 亚洲高清三级视频| 久久久99精品久久| 欧美日韩二区三区| 不卡欧美aaaaa| 麻豆一区二区在线| 亚洲精品国产一区二区精华液 | 欧美三区在线观看| 国产一区二区三区蝌蚪| 一区二区欧美国产| 国产亚洲一区二区在线观看| 欧美乱妇一区二区三区不卡视频| 国产成人综合亚洲91猫咪| 亚洲午夜精品网| 日本一区二区三区四区| 9191成人精品久久| 一本色道久久综合亚洲91| 激情综合网激情| 日韩电影在线免费观看| 亚洲伦在线观看| 欧美国产成人在线| 日韩免费视频一区| 精品视频一区二区三区免费| 成人av资源下载| 国模娜娜一区二区三区| 日本不卡一二三区黄网| 玉米视频成人免费看| 中文字幕一区二区三区在线播放| 欧美精品一区二区不卡| 正在播放亚洲一区| 欧美三级日本三级少妇99| 99久久精品情趣| 国产成人亚洲综合色影视| 麻豆精品一二三| 日韩成人午夜精品| 午夜精品久久久久影视| 亚洲综合色丁香婷婷六月图片| 国产精品久久夜| 欧美国产在线观看| 亚洲国产成人在线| 国产人成亚洲第一网站在线播放| 精品入口麻豆88视频| 精品少妇一区二区三区在线播放 | 免费日韩伦理电影| 欧美a级一区二区| 日本不卡视频一二三区| 视频在线观看国产精品| 亚洲制服丝袜av| 亚洲成人免费av| 日精品一区二区| 日本不卡中文字幕| 久久精品国产亚洲a| 韩国av一区二区三区四区| 国内精品免费**视频| 国产毛片精品一区| 国产不卡高清在线观看视频| 国产米奇在线777精品观看| 国产精品亚洲午夜一区二区三区| 国产精品原创巨作av| 成人污污视频在线观看| 91丝袜美腿高跟国产极品老师| 色8久久精品久久久久久蜜| 欧美三级资源在线| 欧美一区二区视频观看视频 | 麻豆一区二区99久久久久| 蜜桃视频一区二区三区| 国产在线乱码一区二区三区| 成人禁用看黄a在线| 91福利在线观看| 日韩无一区二区| 欧美韩国日本一区| 亚洲一区二区三区在线看| 免费成人av在线| 福利电影一区二区| 欧美色图激情小说| 日韩精品一区二区三区视频 | 日韩区在线观看| 亚洲国产精品成人综合| 亚洲一区二区视频在线| 国内不卡的二区三区中文字幕| 成人97人人超碰人人99| 欧美丰满嫩嫩电影| 国产人妖乱国产精品人妖| 亚洲午夜av在线| 国产乱码一区二区三区| 在线视频一区二区三区| 久久久亚洲午夜电影| 亚洲精品国产视频| 国内精品视频666| 欧美视频日韩视频在线观看| 欧美精品一区二区三区四区| 亚洲欧美另类久久久精品| 久久国产剧场电影| 欧美中文字幕一二三区视频| 久久久久久久久久久久电影| 午夜成人在线视频| 成人午夜私人影院| 日韩三级高清在线| 亚洲自拍偷拍麻豆| 成人看片黄a免费看在线| 91精品午夜视频| 一区二区三区高清| 国产成人精品三级麻豆| 日韩精品中文字幕在线一区| 亚洲一区二区三区免费视频| 成人精品小蝌蚪| 久久综合色之久久综合| 五月婷婷久久丁香| 国产欧美一区在线| 蜜桃视频在线一区| 欧美日韩视频在线观看一区二区三区| 国产亚洲人成网站| 久久精品国产99国产精品| 欧美久久久影院| 亚洲二区在线视频| 在线免费观看成人短视频| 国产精品久久久久国产精品日日| 久久66热偷产精品| 日韩一区二区三| 免费成人av在线| 欧美一区二区黄色| 欧美bbbbb| 日韩欧美一卡二卡| 九九久久精品视频| 欧美成人video| 精品一区二区免费| 精品第一国产综合精品aⅴ| 麻豆精品一区二区三区| 日韩欧美中文字幕一区|