mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Added Replace()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@360 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
17
String.cpp
17
String.cpp
@@ -92,6 +92,23 @@ CString CString::AsLower() const {
|
||||
return sRet;
|
||||
}
|
||||
|
||||
unsigned int CString::Replace(const CString& sReplace, const CString& sWith) {
|
||||
return CString::Replace(*this, sReplace, sWith);
|
||||
}
|
||||
|
||||
unsigned int CString::Replace(CString& sStr, const CString& sReplace, const CString& sWith) {
|
||||
unsigned int uRet = 0;
|
||||
size_type uPos = sStr.find(sReplace);
|
||||
|
||||
while (uPos != npos) {
|
||||
sStr.replace(uPos, sReplace.length(), sWith);
|
||||
uPos = sStr.find(sReplace);
|
||||
uRet++;
|
||||
}
|
||||
|
||||
return uRet;
|
||||
}
|
||||
|
||||
CString CString::Token(unsigned int uPos, bool bRest, char cSep) const {
|
||||
string sRet;
|
||||
const char* p = c_str();
|
||||
|
||||
Reference in New Issue
Block a user