#include "pch.h" //#include "StdAfx.h" #include "Utils.h" #include #include using namespace std; void DivideStringToArray(const CString& strSrc, const CString& strSeparator, CStringArray &arrayDest) { int startIndex = 0; while(startIndex < strSrc.GetLength()) { int endIndex = strSrc.Find(strSeparator , startIndex); if (endIndex == -1) { endIndex = strSrc.GetLength(); } arrayDest.Add( strSrc.Mid(startIndex , endIndex - startIndex)); startIndex = endIndex + strSeparator.GetLength(); } } void MergeArrayToString(const CStringArray &arraysrc , const CString& strSeparator, CString &strDest) { int count = arraysrc.GetCount(); if (count <= 0) { return; } strDest = arraysrc[0]; for (int n = 1 ; n < count ; ++n) { strDest += strSeparator + arraysrc[n]; } } CString PZStrToCString(const char * pzstr) { return CStrA2CStrT(pzstr); } int RegexMatch(const CString& line, const CString& reg, CString results[]) { string sline=CString2String(line); regex sreg(CString2String(reg)); smatch matchresults; int count = 0; if (regex_match(sline,matchresults,sreg)) { for (int i=0; i