本文整理汇总了C++中CStdString::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ CStdString::begin方法的具体用法?C++ CStdString::begin怎么用?C++ CStdString::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStdString
的用法示例。
在下文中一共展示了CStdString::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertJSON
void CScraperParser::ConvertJSON(CStdString &string)
{
CRegExp reg;
reg.RegComp("\\\\u([0-f]{4})");
while (reg.RegFind(string.c_str()) > -1)
{
int pos = reg.GetSubStart(1);
std::string szReplace(reg.GetMatch(1));
CStdString replace = StringUtils::Format("&#x%s;", szReplace.c_str());
string.replace(string.begin()+pos-2, string.begin()+pos+4, replace);
}
CRegExp reg2;
reg2.RegComp("\\\\x([0-9]{2})([^\\\\]+;)");
while (reg2.RegFind(string.c_str()) > -1)
{
int pos1 = reg2.GetSubStart(1);
int pos2 = reg2.GetSubStart(2);
std::string szHexValue(reg2.GetMatch(1));
CStdString replace = StringUtils::Format("%c", strtol(szHexValue.c_str(), NULL, 16));
string.replace(string.begin()+pos1-2, string.begin()+pos2+reg2.GetSubLength(2), replace);
}
StringUtils::Replace(string, "\\\"","\"");
}
示例2: GetPathList
void PathReadWriter::GetPathList(const CStdString& sPathList, std::vector<CStdString>& pathList)
{
pathList.clear();
pathList.reserve(std::count(sPathList.begin(), sPathList.end(), _T(';')) + 1);
int nStartPos = 0;
for (int nEndPos = (int) sPathList.find(_T(';'));
nEndPos >= 0;
nEndPos = (int) sPathList.find(_T(';'), nStartPos = nEndPos + 1))
{
CStdString sSubPath = sPathList.Mid(nStartPos, nEndPos - nStartPos).Trim();
if (!sSubPath.IsEmpty())
{
::PathRemoveBackslash(sSubPath.GetBuffer(MAX_PATH));
sSubPath.ReleaseBuffer();
pathList.push_back(sSubPath);
}
}
CStdString sSubPath = sPathList.Mid(nStartPos).Trim();
if (!sSubPath.IsEmpty())
{
::PathRemoveBackslash(sSubPath.GetBuffer(MAX_PATH));
sSubPath.ReleaseBuffer();
pathList.push_back(sSubPath);
}
}
示例3: temp
std::vector<CStdString> split(const CStdString& s, const CStdString& delim, const bool keep_empty) {
std::vector<CStdString> result;
if (delim.empty()) {
result.push_back(s);
return result;
}
CStdString::const_iterator substart = s.begin(), subend;
while (true) {
subend = search(substart, s.end(), delim.begin(), delim.end());
CStdString temp(substart, subend);
if (keep_empty || !temp.empty()) {
result.push_back(temp);
}
if (subend == s.end()) {
break;
}
substart = subend + delim.size();
}
return result;
}
示例4: ReplaceBuffers
void CScraperParser::ReplaceBuffers(CStdString& strDest)
{
// insert buffers
int iIndex;
for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--)
{
CStdString temp;
iIndex = 0;
temp.Format("$$%i",i+1);
while ((size_t)(iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING
{
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.GetLength(),m_param[i]);
iIndex += m_param[i].length();
}
}
// insert settings
iIndex = 0;
while ((size_t)(iIndex = strDest.find("$INFO[",iIndex)) != CStdString::npos)
{
int iEnd = strDest.Find("]",iIndex);
CStdString strInfo = strDest.Mid(iIndex+6,iEnd-iIndex-6);
CStdString strReplace;
if (m_scraper)
strReplace = m_scraper->GetSetting(strInfo);
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
iIndex += strReplace.length();
}
iIndex = 0;
while ((size_t)(iIndex = strDest.find("\\n",iIndex)) != CStdString::npos)
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n");
}
示例5: ReplaceInvalidFileNameChars
CStdString DocProvHelper::ReplaceInvalidFileNameChars(CStdString sString) const
{
while (true)
{
/* TXTEX_IGNORE */ int iPos = sString.FindOneOf(_T(":*?\"&<>|"));
if (iPos==-1)
break;
sString.erase(sString.begin()+iPos);
}
return sString;
}
示例6: ReplaceBuffers
void CScraperParser::ReplaceBuffers(CStdString& strDest)
{
// insert buffers
size_t iIndex;
for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--)
{
iIndex = 0;
CStdString temp = StringUtils::Format("$$%i",i+1);
while ((iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING
{
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.size(),m_param[i]);
iIndex += m_param[i].length();
}
}
// insert settings
iIndex = 0;
while ((iIndex = strDest.find("$INFO[", iIndex)) != CStdString::npos)
{
size_t iEnd = strDest.find("]", iIndex);
CStdString strInfo = strDest.substr(iIndex+6, iEnd - iIndex - 6);
CStdString strReplace;
if (m_scraper)
strReplace = m_scraper->GetSetting(strInfo);
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
iIndex += strReplace.length();
}
// insert localize strings
iIndex = 0;
while ((iIndex = strDest.find("$LOCALIZE[", iIndex)) != CStdString::npos)
{
size_t iEnd = strDest.find("]", iIndex);
CStdString strInfo = strDest.substr(iIndex+10, iEnd - iIndex - 10);
CStdString strReplace;
if (m_scraper)
strReplace = m_scraper->GetString(strtol(strInfo.c_str(),NULL,10));
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace);
iIndex += strReplace.length();
}
iIndex = 0;
while ((iIndex = strDest.find("\\n",iIndex)) != CStdString::npos)
strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n");
}