summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libutil.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-25 08:58:25 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-25 08:58:25 +0000
commitec685f4e71424403b322d3971ac68b31821fe7e1 (patch)
tree11a11f0c7214a74048bcfa0a013a8b7beba204cf /crawl-ref/source/libutil.cc
parenteb51ffff58cbb272a5332f946ca9ca903ec4695e (diff)
downloadcrawl-ref-ec685f4e71424403b322d3971ac68b31821fe7e1.tar.gz
crawl-ref-ec685f4e71424403b322d3971ac68b31821fe7e1.zip
Cleaned up hiscores xlog format (suggested by Shawn Moore). Breaks compatbility
with older xlogfiles. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1093 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libutil.cc')
-rw-r--r--crawl-ref/source/libutil.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 0b7772b531..c7e057a9e0 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -193,6 +193,22 @@ void lowercase(std::string &s)
s[i] = tolower(s[i]);
}
+std::string replace_all(std::string s,
+ const std::string &find,
+ const std::string &repl)
+{
+ std::string::size_type start = 0;
+ std::string::size_type found;
+
+ while ((found = s.find(find, start)) != std::string::npos)
+ {
+ s.replace( found, find.length(), repl );
+ start = found + repl.length();
+ }
+
+ return (s);
+}
+
// Replaces all occurrences of any of the characters in tofind with the
// replacement string.
std::string replace_all_of(std::string s,