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

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

?? stringex.cpp

?? 一個功能挺多的
?? CPP
字號:

//////////////////////////////////////////////////////////////////////
// StringEx.cpp
//
//
//Modify by 徐景周 2000.10
//功能:字符串操作擴展類
//
#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一区二区三区免费野_久草精品视频
26uuu国产一区二区三区| 日本网站在线观看一区二区三区| 精品三级在线看| 51久久夜色精品国产麻豆| 欧美日韩免费视频| 欧美三区在线观看| 欧美日韩国产首页在线观看| 欧美三级视频在线播放| 在线观看一区不卡| 欧美三级日本三级少妇99| 欧美亚洲日本国产| 8v天堂国产在线一区二区| 777精品伊人久久久久大香线蕉| 欧美性三三影院| 欧美人xxxx| 日韩欧美色电影| 久久亚洲综合av| 国产农村妇女精品| 亚洲欧美经典视频| 亚洲一二三四在线| 日本视频在线一区| 久久黄色级2电影| 丰满白嫩尤物一区二区| 国产精品网曝门| 欧美激情一区二区三区不卡| 国产精品麻豆欧美日韩ww| 亚洲欧美韩国综合色| 亚洲不卡一区二区三区| 免费看日韩a级影片| 国产乱人伦偷精品视频免下载| 国产99精品国产| 91福利视频久久久久| 91精品国产欧美一区二区成人| 精品国产凹凸成av人导航| 中文乱码免费一区二区| 亚洲国产成人精品视频| 久久av中文字幕片| 成人精品一区二区三区四区| 91国产免费观看| 日韩你懂的在线观看| 国产精品无圣光一区二区| 亚洲妇女屁股眼交7| 国产成人自拍在线| 在线观看视频一区| 精品国产伦一区二区三区免费 | 久久久亚洲综合| 国产精品久久久久久久久搜平片| 亚洲成人一区二区| 国产精品一区二区久激情瑜伽| 91网站在线观看视频| 日韩三级免费观看| 中文av一区二区| 日韩成人免费看| gogogo免费视频观看亚洲一| 制服视频三区第一页精品| 国产精品丝袜在线| 免费日韩伦理电影| 色综合咪咪久久| 精品精品欲导航| 亚洲综合久久久| 国产jizzjizz一区二区| 777奇米四色成人影色区| 国产精品国产精品国产专区不片| 麻豆精品在线视频| 色悠悠亚洲一区二区| 久久久精品一品道一区| 丝袜美腿亚洲一区二区图片| 91亚洲大成网污www| 欧美xxxxxxxxx| 午夜视频在线观看一区二区| 成人精品小蝌蚪| 2023国产一二三区日本精品2022| 亚洲成人av一区二区三区| 不卡的av网站| 久久亚洲二区三区| 七七婷婷婷婷精品国产| 在线观看免费一区| 1024亚洲合集| 大尺度一区二区| 欧美精品一区二区三区视频| 性做久久久久久久免费看| 91在线porny国产在线看| 国产欧美一区二区精品性色| 在线播放国产精品二区一二区四区| 国产精品久久一卡二卡| 韩国精品主播一区二区在线观看| 欧美精三区欧美精三区| 亚洲精品v日韩精品| aaa国产一区| 国产欧美一区在线| 国产福利精品导航| 精品成人一区二区三区| 蜜桃视频一区二区| 91精品国产综合久久香蕉的特点 | 日韩av不卡一区二区| 色天使久久综合网天天| 国产精品看片你懂得| 成人午夜在线免费| 久久精品亚洲精品国产欧美kt∨| 久久精品国产成人一区二区三区 | 91黄视频在线| 亚洲人成7777| 色综合天天综合色综合av| 中文字幕在线观看不卡视频| 成人性视频免费网站| 国产日韩一级二级三级| 国产美女精品在线| 欧美高清在线视频| 成人黄色av电影| 亚洲欧美综合网| 99国产欧美另类久久久精品| 亚洲色图第一区| 91久久奴性调教| 亚洲一区二区三区四区在线| 欧美日韩国产在线观看| 日韩黄色免费电影| 日韩一级精品视频在线观看| 狠狠色丁香久久婷婷综合_中| 欧美不卡视频一区| 国产99久久精品| 《视频一区视频二区| 色视频成人在线观看免| 亚洲成人av一区| 日韩精品一区二区三区蜜臀 | 色综合天天综合色综合av| 一区二区三区在线视频播放| 在线观看www91| 日本不卡一区二区三区高清视频| 欧美不卡一区二区三区| 国产成人午夜高潮毛片| 亚洲日本一区二区| 欧美日韩一级片在线观看| 蜜臀av性久久久久蜜臀av麻豆| 精品国产伦理网| 91网上在线视频| 日韩精品亚洲一区| 久久久国产精品午夜一区ai换脸| 成人99免费视频| 香蕉成人伊视频在线观看| 欧美tk丨vk视频| av高清久久久| 亚洲超丰满肉感bbw| 久久日韩粉嫩一区二区三区| www.欧美日韩国产在线| 亚洲综合999| 日本怡春院一区二区| 国产午夜久久久久| 日本伦理一区二区| 久久精品国产99国产| 1024国产精品| 日韩精品中文字幕一区 | 欧美大片一区二区| 成人短视频下载 | 欧美色中文字幕| 国模一区二区三区白浆| 亚洲激情在线激情| 日韩欧美电影一二三| 一本一道综合狠狠老| 老汉av免费一区二区三区| 亚洲视频一区二区在线观看| 欧美一二三区精品| 一本大道av伊人久久综合| 久久精品二区亚洲w码| 一区二区三国产精华液| 国产亚洲一区字幕| 欧美二区在线观看| 91小视频免费看| 国产精品自在欧美一区| 天天综合天天综合色| 中文字幕制服丝袜一区二区三区 | 韩国欧美国产1区| 亚洲一区在线看| 国产精品久久毛片av大全日韩| 6080国产精品一区二区| 色悠悠亚洲一区二区| 丁香一区二区三区| 美女视频免费一区| 亚洲成a天堂v人片| 亚洲色大成网站www久久九九| 精品日韩99亚洲| 欧美美女激情18p| 91官网在线免费观看| 不卡一区中文字幕| 国产精品综合二区| 蜜桃久久av一区| 午夜视频久久久久久| 亚洲精品一二三四区| 国产精品美女一区二区在线观看| 欧美xfplay| 欧美一区二区三区免费观看视频| 91极品美女在线| 色综合天天视频在线观看| 久久综合久久综合久久| 欧美一区二区国产| 精品视频999| 色综合久久综合网欧美综合网| av在线综合网| 波多野结衣的一区二区三区| 国产大陆a不卡| 国产精品一区二区久激情瑜伽|