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

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

?? stringex.cpp

?? GB2BIG5是一個簡體和繁體中文雙向轉換程序。
?? CPP
字號:

//////////////////////////////////////////////////////////////////////
// StringEx.cpp
//

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


// 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+len)));

	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;
}


// 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
{
	// find first single character
	LPTSTR lpsz = _tcschr(m_pchData + startpos, (_TUCHAR)ch);

	// return -1 if not found and index otherwise
	return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData);
}


// 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
{
	ASSERT(AfxIsValidString(lpszSub, FALSE));

	// find first matching substring
	LPTSTR lpsz = _tcsstr(m_pchData+startpos, lpszSub);

	// return -1 for not found, distance from beginning otherwise
	return (lpsz == NULL) ? -1 : (int)(lpsz - m_pchData);
}


// 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;
	
	int pos = 0;
	int lenSub = lstrlen( lpszSub );
	int lenReplaceWith = lstrlen( lpszReplaceWith );
	while( (lpsz = _tcsstr(m_pchData + pos, lpszSub)) != NULL )
	{
		pos = (int)(lpsz - m_pchData);
		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*/ )
{
	CStringEx sLowerThis = *this;
	sLowerThis.MakeLower();

	CStringEx sLowerSub = lpszSub;
	sLowerSub.MakeLower();

	int iReplaced = 0;

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

	return iReplaced;
}


// 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*/ ) const
{
	int lenSub = lstrlen( lpszSub );
	int len = lstrlen( m_pchData );

	if(0 < lenSub && 0 < len)
	{
		if( startpos == -1 || startpos >= len ) startpos = len - 1;
		for ( LPTSTR lpszReverse = m_pchData + startpos ; 
						lpszReverse != m_pchData ; --lpszReverse)
			if (_tcsncmp(lpszSub, lpszReverse, lenSub ) == 0)
				return (lpszReverse - m_pchData);
	}
	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*/ ) const
{
	TCHAR a[2];
	a[1] = ch;
	a[2] = 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*/ ) const
{
	//LPTSTR lpszEnd = m_pchData + lstrlen

	int lenSub = lstrlen( lpszSub );
	int len = lstrlen( m_pchData );
	

	if(0 < lenSub && 0 < len)
	{
		if( startpos == -1 || startpos >= len ) startpos = len - 1;
		for ( LPTSTR lpszReverse = m_pchData + startpos ; 
				lpszReverse >= m_pchData ; --lpszReverse)
			if (_tcsnicmp(lpszSub, lpszReverse, lenSub ) == 0)
				return (lpszReverse - m_pchData);
	}
	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 = m_pchData, 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 - m_pchData, 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 = m_pchData, 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 - m_pchData, 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[1] = delim;
	a[2] = 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 = m_pchData;
	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 = m_pchData ;
	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 - m_pchData, lpszEnd - lpszRet );
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲无码一区二区三区| 精品av久久707| 99久久er热在这里只有精品66| 精品系列免费在线观看| 日本在线播放一区二区三区| 亚洲大型综合色站| 视频一区二区三区中文字幕| 日日骚欧美日韩| 全部av―极品视觉盛宴亚洲| 捆绑紧缚一区二区三区视频 | 99久久国产综合色|国产精品| 国产成人精品影视| www.亚洲精品| 色诱视频网站一区| 5566中文字幕一区二区电影| 91精品久久久久久久久99蜜臂| 91精品国产麻豆国产自产在线 | 中文字幕一区二区三区视频| 成人免费一区二区三区在线观看| 亚洲色图色小说| 一区二区视频免费在线观看| 亚洲国产精品久久久久婷婷884| 亚洲国产va精品久久久不卡综合 | 久久国产生活片100| 91精品国产综合久久小美女| 91精品欧美福利在线观看| 欧美成人女星排名| 国产精品久久福利| 日韩二区三区四区| 99国产欧美另类久久久精品| 欧美丰满嫩嫩电影| 中文字幕第一区综合| 亚洲黄色尤物视频| 国产乱人伦偷精品视频不卡 | 国产盗摄一区二区三区| 一本久久综合亚洲鲁鲁五月天| 欧美剧情电影在线观看完整版免费励志电影 | 在线成人av网站| 欧美激情在线看| 日韩精品电影一区亚洲| 粉嫩av一区二区三区| 91麻豆精品国产91久久久更新时间 | 国产精品国产三级国产专播品爱网 | 国产成人免费高清| 精品视频在线免费| 国产精品国产馆在线真实露脸| 亚洲成人高清在线| www.久久精品| 精品国产乱码久久久久久老虎| 亚洲与欧洲av电影| 成人性色生活片| 久久网站最新地址| 蜜臀av亚洲一区中文字幕| 在线精品视频免费播放| 日本一区二区三区在线不卡| 美女国产一区二区三区| 欧美在线三级电影| 亚洲人成影院在线观看| 国产成人一级电影| 日韩欧美电影在线| 亚洲午夜免费视频| 国产亚洲一区二区三区在线观看 | 亚洲精品国产一区二区三区四区在线| 国产综合成人久久大片91| 6080国产精品一区二区| 亚洲美女免费视频| 99久久久免费精品国产一区二区 | 欧美午夜精品久久久久久孕妇| 国产精品嫩草影院av蜜臀| 国产不卡高清在线观看视频| 久久久久久99精品| 高清久久久久久| 中文子幕无线码一区tr| 高清国产一区二区三区| 国产色一区二区| 成人免费av在线| 中文字幕佐山爱一区二区免费| 成人av网站在线观看| 国产精品久久福利| 色播五月激情综合网| 玉足女爽爽91| 欧美日韩国产综合一区二区 | 激情五月婷婷综合| 久久久99精品免费观看不卡| 国产在线观看一区二区| 国产亚洲一区二区在线观看| 日韩三级电影网址| 国产剧情一区在线| 国产精品久久777777| 欧美在线|欧美| 日韩中文字幕区一区有砖一区| 欧美一区二区久久| 国产a级毛片一区| 亚洲乱码国产乱码精品精98午夜| 欧美日韩一区三区四区| 青草国产精品久久久久久| 久久午夜免费电影| eeuss鲁片一区二区三区在线看| 亚洲精品伦理在线| 欧美一区二区在线视频| 国产成人av影院| 一区二区三区视频在线观看| 51精品国自产在线| 成人黄色电影在线| 午夜久久电影网| 国产视频一区二区在线观看| 在线一区二区三区四区| 麻豆精品新av中文字幕| 亚洲欧洲日产国码二区| 欧美日韩亚洲综合一区| 精品亚洲免费视频| 一区二区久久久| 国产三级欧美三级日产三级99| 91黄色在线观看| 国产一二三精品| 亚洲成av人片| 亚洲欧美偷拍卡通变态| 日韩精品一区二区三区蜜臀| 色偷偷久久一区二区三区| 激情五月播播久久久精品| 亚洲综合图片区| 成人欧美一区二区三区小说| 精品日韩一区二区| 欧美日韩一区国产| 不卡av免费在线观看| 寂寞少妇一区二区三区| 亚洲成a天堂v人片| 国产精品对白交换视频 | 亚洲人成小说网站色在线| 日韩美女一区二区三区| 91久久精品一区二区二区| 国产精品亚洲一区二区三区妖精| 日日骚欧美日韩| 亚洲福利一二三区| 亚洲视频每日更新| 国产精品动漫网站| 中文字幕高清一区| 国产精品美日韩| 国产日本一区二区| 久久久久久久综合色一本| 日韩丝袜情趣美女图片| 欧美色综合天天久久综合精品| 日韩欧美成人一区二区| 日韩一区二区精品在线观看| 欧美男人的天堂一二区| 欧美老年两性高潮| 337p亚洲精品色噜噜狠狠| 精品视频在线看| 91麻豆精品国产91久久久使用方法| 欧美午夜电影一区| 欧美精品99久久久**| 欧美高清性hdvideosex| 91麻豆精品91久久久久同性| 欧美美女视频在线观看| 91麻豆精品国产91久久久久| 日韩三级精品电影久久久| 欧美一级黄色大片| 26uuu另类欧美| 欧美国产一区二区在线观看| 国产精品私人影院| 亚洲人吸女人奶水| 午夜精品免费在线观看| 视频一区二区欧美| 激情五月播播久久久精品| 国产福利视频一区二区三区| 成人免费毛片aaaaa**| a4yy欧美一区二区三区| 一本一本久久a久久精品综合麻豆| 91成人网在线| 日韩精品综合一本久道在线视频| 26uuu久久天堂性欧美| 中文字幕一区二区三区视频| 亚洲综合网站在线观看| 日本vs亚洲vs韩国一区三区| 韩国中文字幕2020精品| 白白色 亚洲乱淫| 欧美日韩亚洲国产综合| 久久久99免费| 一区二区三区中文字幕在线观看| 日韩精品乱码av一区二区| 国产福利一区二区三区| 在线观看成人小视频| www国产精品av| 一区二区欧美视频| 久久精品国产精品亚洲精品| 成人av中文字幕| 欧美精品一二三四| 国产精品天干天干在观线| 图片区小说区区亚洲影院| 成人免费va视频| 欧美一区二区三区在线观看| 中文字幕在线观看不卡视频| 三级久久三级久久| 91亚洲精品久久久蜜桃| 日韩欧美一级在线播放| 亚洲男人天堂一区| 国产乱码精品一区二区三区av | 制服丝袜成人动漫| 国产精品美女久久久久aⅴ| 日韩精品成人一区二区三区|