summaryrefslogtreecommitdiff
path: root/libs/pbd/strreplace.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-04-11 13:07:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-04-11 13:07:51 +0000
commit45d3ec1437cf661533bc7750c623865def4424df (patch)
tree80cdeb58bc51a22042b91c50334bdd8ee37deed6 /libs/pbd/strreplace.cc
parent4bf712f501e21cbf1e555bf010553aaca55edd39 (diff)
merged with 1697 revision of trunk (which is post-rc1 but pre-rc2
git-svn-id: svn://localhost/ardour2/branches/2.1-staging@1698 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/strreplace.cc')
-rw-r--r--libs/pbd/strreplace.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/pbd/strreplace.cc b/libs/pbd/strreplace.cc
new file mode 100644
index 0000000000..dd90baf324
--- /dev/null
+++ b/libs/pbd/strreplace.cc
@@ -0,0 +1,19 @@
+#include <pbd/replace_all.h>
+
+int
+replace_all (std::string& str,
+ std::string const& target,
+ std::string const& replacement)
+{
+ std::string::size_type start = str.find (target, 0);
+ int cnt = 0;
+
+ while (start != std::string::npos) {
+ str.replace (start, target.size(), replacement);
+ start = str.find (target, start+replacement.size());
+ ++cnt;
+ }
+
+ return cnt;
+}
+