Common.h[1]

发布于 2020-12-28  55 次阅读


string parsingToStringBegin(const string &strLine, const int &iBeginPos, const string &strFindEnd, int &iEndPos2)
{
	if((iEndPos2 = strLine.find(strFindEnd, iBeginPos)) >= 0)
    {
    	return strLine.substr(iBeginPos, iEndPos2 - iBeginPos);
    }
    else
    {
    	return "NULL";
    }
}

string parsingToString(const string &strLine, const string &strFindBegin, const int &iBeginPos, const string &strFindEnd, int &iEndPos2)
{
    int pos = 0;

    if((pos = strLine.find(strFindBegin, iBeginPos)) >= 0)
    {
        iEndPos2 = strLine.find(strFindEnd, pos + strFindBegin.size());
        
        return strLine.substr(pos + strFindBegin.size(), iEndPos2 - (pos + strFindBegin.size()));
    }
    else
    {
    	return "NULL";
    }
}

string parsingToStringEnd(const string &strLine, const string &strFindBegin, const int &iBeginPos)
{
    int pos = 0;

    if((pos = strLine.find(strFindBegin, iBeginPos)) >= 0)
    {
        return strLine.substr(pos + strFindBegin.size(), strLine.size() - (pos + strFindBegin.size()));
    }
    else
    {
    	return "NULL";
    }
}