From 47b458eed1e151e798a20681038c5f713c2454e1 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Wed, 24 Aug 2005 05:50:21 +0000 Subject: [PATCH] new helper function Replace() svn path=/trunk/; revision=17505 --- reactos/tools/rbuild/module.cpp | 19 +++++++++++++++++++ reactos/tools/rbuild/rbuild.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index c8d328a5598..907991a0f06 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -23,6 +23,25 @@ using std::string; 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 FixSeparator ( const string& s ) { diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index d64392d7cca..c67bf4b0d4b 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -739,6 +739,8 @@ private: 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 FixSeparator ( const std::string& s );