mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
new helper function Replace()
svn path=/trunk/; revision=17505
This commit is contained in:
parent
db03491cdc
commit
47b458eed1
2 changed files with 21 additions and 0 deletions
|
@ -23,6 +23,25 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
string
|
||||||
|
Replace ( const string& s, const string& find, const string& with )
|
||||||
|
{
|
||||||
|
string ret;
|
||||||
|
const char* p = s.c_str();
|
||||||
|
while ( p )
|
||||||
|
{
|
||||||
|
const char* p2 = strstr ( p, find.c_str() );
|
||||||
|
if ( !p2 )
|
||||||
|
break;
|
||||||
|
if ( p2 > p )
|
||||||
|
ret += string ( p, p2-p );
|
||||||
|
p = p2 + find.size();
|
||||||
|
}
|
||||||
|
if ( *p )
|
||||||
|
ret += *p;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
FixSeparator ( const string& s )
|
FixSeparator ( const string& s )
|
||||||
{
|
{
|
||||||
|
|
|
@ -739,6 +739,8 @@ private:
|
||||||
std::string StripSymbol ( std::string symbol );
|
std::string StripSymbol ( std::string symbol );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern std::string
|
||||||
|
Replace ( const std::string& s, const std::string& find, const std::string& with );
|
||||||
|
|
||||||
extern std::string
|
extern std::string
|
||||||
FixSeparator ( const std::string& s );
|
FixSeparator ( const std::string& s );
|
||||||
|
|
Loading…
Reference in a new issue