Code:std::string LeftTrim(const char * pString) { while (*pString == ' ') { ++pString; } std::string retValue(pString); return retValue; } std::string LeftTrim(const char * pString,const char * pCharSet) { bool bFound; while (true) { bFound = false; const char * pSet = pCharSet; while (bFound == false && *pSet != 0) { if (*pString == *pSet) { ++pString; bFound = true; } else { ++pSet; } } if (bFound == false) { break; } } std::string strRetValue(pString); return strRetValue; }




Reply With Quote