오히려 CString 사용했을 때가 더 빠를 때도 있음...
int Parse(LPCTSTR str, LPCTSTR delim, int startPos, int* pTrkEndPos)
{
for (int i = startPos; str[i] != _T(\'\\0\'); ++i)
{
*pTrkEndPos = i;
int j = 0;
while (str[i] == delim[j] || str[i+1] == _T(\'\\0\'))
{
if (delim[j+1] == _T(\'\\0\'))
{
return i+1;
}
++j;
++i;
}
}
return -1;
}
#define B
int main()
{
DWORD dwStart = ::GetTickCount();
LPCTSTR str = _T("1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203\\t1234\\tasdf\\t010203");
CString s = str;
#ifdef A
int start = 0;
int end;
int next;
while ((next = Parse(str, _T("\\t"), start, &end)) >= 0)
{
CString s;
s.SetString(str+start, end - start);
std::cout << s << std::endl;
start = next;
}
#endif
#ifdef B
int i = 0;
while (i >= 0)
{
std::cout << s.Tokenize(_T("\\t"), i) << std::endl;
}
#endif
#ifdef C
#endif
DWORD dwEnd = ::GetTickCount();
std::cout << dwEnd - dwStart << std::endl;
return 0;
}
댓글 영역
획득법
① NFT 발행
작성한 게시물을 NFT로 발행하면 일주일 동안 사용할 수 있습니다. (최초 1회)
② NFT 구매
다른 이용자의 NFT를 구매하면 한 달 동안 사용할 수 있습니다. (구매 시마다 갱신)
사용법
디시콘에서지갑연결시 바로 사용 가능합니다.