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

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

?? stringex.cpp

?? CHMReader:閱讀CHM文件的工具的源代碼. 平臺:WinCE 開發工具: EVC4
?? 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电影在线| 久久久美女毛片| 另类专区欧美蜜桃臀第一页| 欧美日韩免费在线视频| 亚洲欧洲中文日韩久久av乱码| 久草这里只有精品视频| 欧美日韩视频在线一区二区| 一区二区三区自拍| 91亚洲午夜精品久久久久久| 国产精品情趣视频| 懂色av一区二区夜夜嗨| 久久亚洲一级片| 精品一区二区三区在线观看| 日韩欧美色综合| 麻豆专区一区二区三区四区五区| 欧美欧美欧美欧美| 亚洲二区在线视频| 欧美日韩国产综合视频在线观看| 亚洲精品中文字幕在线观看| 一本到三区不卡视频| 亚洲视频精选在线| av电影天堂一区二区在线观看| 国产欧美日韩精品一区| 成人影视亚洲图片在线| 国产午夜三级一区二区三| 国产成人亚洲综合a∨婷婷 | 99久久精品情趣| 国产精品色眯眯| 91污片在线观看| 伊人婷婷欧美激情| 欧美日韩一级片在线观看| 日韩成人伦理电影在线观看| 91精品国产综合久久久久久久久久| 天堂精品中文字幕在线| 日韩视频一区二区| 国产精品888| 综合精品久久久| 欧美丝袜丝nylons| 奇米四色…亚洲| 久久美女艺术照精彩视频福利播放| 国产一区二区三区四区在线观看| 久久久国产精品午夜一区ai换脸| 国产伦精品一区二区三区免费迷 | 欧美高清在线视频| 99久久久久免费精品国产| 亚洲成人av电影| 26uuu欧美| 91丨porny丨户外露出| 日韩精品午夜视频| 欧美极品aⅴ影院| 欧洲精品一区二区| 精品夜夜嗨av一区二区三区| 国产精品乱码人人做人人爱 | 国产麻豆精品在线观看| 最新中文字幕一区二区三区| 欧美日本在线看| 黑人巨大精品欧美一区| 亚洲男人的天堂在线aⅴ视频 | 天天色天天操综合| 欧美经典三级视频一区二区三区| 在线观看日韩精品| 国产麻豆成人精品| 亚洲国产欧美日韩另类综合| 久久亚洲精精品中文字幕早川悠里| 91污片在线观看| 国产精品自在在线| 婷婷国产在线综合| 亚洲欧美综合色| 2024国产精品| 欧美日韩免费一区二区三区视频| 国产夫妻精品视频| 青青草国产成人av片免费| 亚洲欧美偷拍卡通变态| 久久综合久久久久88| 欧美巨大另类极品videosbest| 不卡欧美aaaaa| 精品一区二区三区久久| 亚洲成a人片在线观看中文| 国产精品久久久久久久久动漫| 精品久久免费看| 欧美美女bb生活片| 91久久国产最好的精华液| 国产91精品一区二区| 狠狠色丁香久久婷婷综合丁香| 香蕉成人伊视频在线观看| 亚洲免费在线看| 国产精品久线观看视频| 久久久综合视频| 精品欧美一区二区三区精品久久 | 亚洲国产一区二区视频| 日本一区二区三级电影在线观看| 欧美一区二区福利在线| 欧美最新大片在线看| 91视频观看视频| 成人免费视频一区二区| 丰满放荡岳乱妇91ww| 国产传媒久久文化传媒| 国产一区二区三区最好精华液| 玖玖九九国产精品| 秋霞午夜av一区二区三区| 午夜精品在线视频一区| 一区二区三区在线免费观看| 亚洲你懂的在线视频| 亚洲日本一区二区三区| 中文字幕一区二区三区精华液| 国产精品久久一卡二卡| 中文字幕亚洲综合久久菠萝蜜| 国产精品欧美一区二区三区| 国产精品麻豆视频| 亚洲欧美日韩精品久久久久| 亚洲三级在线观看| 亚洲图片欧美视频| 日韩高清不卡一区二区| 无码av免费一区二区三区试看| 亚洲va在线va天堂| 六月婷婷色综合| 国产不卡在线一区| 成人18视频在线播放| 91农村精品一区二区在线| 色噜噜狠狠成人网p站| 欧美日本高清视频在线观看| 欧美一级高清大全免费观看| 精品久久久网站| 国产精品久久99| 亚洲福利视频一区| 久久成人18免费观看| 成人不卡免费av| 欧美性猛交xxxx乱大交退制版| 欧美精品aⅴ在线视频| 精品盗摄一区二区三区| 亚洲欧美综合网| 日本女优在线视频一区二区| 国产麻豆视频一区| 日本高清不卡一区| 日韩欧美一区二区不卡| 国产精品久久久久久久久果冻传媒 | 2017欧美狠狠色| 亚洲天堂精品视频| 青青草精品视频| www.一区二区| 欧美一级日韩一级| 国产精品网站在线观看| 亚洲va天堂va国产va久| 国产高清不卡一区二区| 欧美三级中文字幕| 欧美国产日韩精品免费观看| 亚洲国产毛片aaaaa无费看| 国产一区视频网站| 精品视频一区二区不卡| 国产拍欧美日韩视频二区| 亚洲成人av一区二区| 国产成人免费xxxxxxxx| 91精品国产综合久久香蕉的特点| 国产精品三级av| 美日韩一级片在线观看| 色婷婷国产精品综合在线观看| 精品粉嫩aⅴ一区二区三区四区| 一级特黄大欧美久久久| 国产电影精品久久禁18| 欧美一区二区三区影视| 综合分类小说区另类春色亚洲小说欧美 | 色综合 综合色| 26uuu久久综合| 日韩高清国产一区在线| 一本大道久久a久久综合婷婷| 国产日韩一级二级三级| 久久精品国产精品亚洲精品| 欧洲亚洲精品在线| 亚洲视频资源在线| 成人av午夜电影| 久久免费精品国产久精品久久久久| 日韩制服丝袜av| 欧洲一区二区三区在线| 亚洲视频 欧洲视频| 成人国产亚洲欧美成人综合网| 精品国产伦一区二区三区观看体验| 亚洲一区二区欧美日韩| 91小视频免费看| 国产精品久久久久影院老司| 国产伦精品一区二区三区免费迷| 欧美伊人久久久久久久久影院 | 欧美成人a在线| 日本不卡一二三| 欧美一区二区三区色| 三级欧美韩日大片在线看| 欧美系列日韩一区|