获取当前应用路径
CString GetAppPath()
{
WCHAR buf[MAX_PATH] = { 0 };
::GetModuleFileName(NULL, buf, MAX_PATH * sizeof(WCHAR));
CString s = CString(buf);
int pos = s.ReverseFind('\\');
if (-1 != pos)
{
s = s.Mid(0, pos);
}
return s;
}
分割CString
vector<CString> Split(CString str, CString splitFlag)
{
vector<CString> result;
CString strTmp = str;
int pos = strTmp.Find(splitFlag);
while (pos > -1)
{
CString v = strTmp.Left(pos);
strTmp = strTmp.Mid(pos + splitFlag.GetLength());
result.push_back(v);
pos = strTmp.Find(splitFlag);
}
result.push_back(strTmp);
return result;
}
分割wchar字符串
vector<CString> Split(const wchar_t *pSrc, int nSize, const wchar_t splitFlag)
{
vector<CString> vList;
CString strTmp;
for (int i = 0; i < nSize; i++)
{
if (splitFlag != *(pSrc + i))
{
strTmp.AppendChar(*(pSrc + i));
}
else
{
if (strTmp.GetLength() > 0)
{
vList.push_back(strTmp);
strTmp.Empty();
}
}
}
return vList;
}

676

被折叠的 条评论
为什么被折叠?



