Skip to content

Commit f9edf73

Browse files
authored
Merge pull request #4273 from tautschnig/remove-replace_all
Remove replace_all string utility
2 parents 6589d99 + 01d1ebe commit f9edf73

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

src/util/string_utils.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -159,28 +159,3 @@ std::string escape(const std::string &s)
159159

160160
return result;
161161
}
162-
163-
/// Replace all occurrences of a string inside a string
164-
/// \param [out] str: string to search
165-
/// \param from: string to replace; must be non-empty
166-
/// \param to: string to replace with
167-
/// Copyright notice:
168-
/// Attributed to Gauthier Boaglio
169-
/// Source: https://stackoverflow.com/a/24315631/7501486
170-
/// Used under MIT license
171-
/// Note that this is quadratic in str.size() if from.size() != to.size().
172-
/// There is no guarantee that it is linear in str.size() if
173-
/// from.size() == to.size().
174-
void replace_all(
175-
std::string &str,
176-
const std::string &from,
177-
const std::string &to)
178-
{
179-
PRECONDITION(!from.empty());
180-
size_t start_pos = 0;
181-
while((start_pos = str.find(from, start_pos)) != std::string::npos)
182-
{
183-
str.replace(start_pos, from.length(), to);
184-
start_pos += to.length();
185-
}
186-
}

src/util/string_utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,4 @@ join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter)
9696
/// programming language.
9797
std::string escape(const std::string &);
9898

99-
void replace_all(std::string &, const std::string &, const std::string &);
100-
10199
#endif

0 commit comments

Comments
 (0)