Code-C++-Cut CString to get keyValue by ","||"}"
2021-04-22 09:26
标签:++ lse etl source flag temp length || code July 10, 2020 2:19 AM Code-C++-Cut CString to get keyValue by ","||"}" 标签:++ lse etl source flag temp length || code 原文地址:https://www.cnblogs.com/yongchao/p/13277267.htmlCode-C++-Cut CString to get keyValue by ","||"}"
// cut CString to get keyValue
void GetKeyValue(CString strSource, CString strKey, CString& strValue)
{
CString strTemp = strSource;
int n = strTemp.Find(strKey.GetString(), 0);
if (n == -1)
{
strValue = _T("0");
return;
}
strTemp = strTemp.Mid(n + strKey.GetLength() + 2); //"AA":BB
int n1 = strTemp.ReverseFind(‘,‘);//End Flag
int n2 = strTemp.ReverseFind(‘}‘);//End Flag
if (n1 >= 0 && n2 >= 0)
{
n = n1 > n2 ? n2 : n1;
}
else if (n1 == -1)
{
n = n2;
}
else if (n2 == -1)
{
n = n1;
}
strValue = strTemp.Left(n);
}
文章标题:Code-C++-Cut CString to get keyValue by ","||"}"
文章链接:http://soscw.com/index.php/essay/78003.html