mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Fixed small bug in replace_all.
Start_pos should of course be 0... Signed-off-by: Victor Arvidsson <victarv@gmail.com>
This commit is contained in:
parent
6886c9ccf8
commit
e58824e636
1 changed files with 2 additions and 2 deletions
|
@ -47,10 +47,10 @@ static std::string video_time(int secs)
|
|||
return format_string_std("%d:%02d:%02d.000,", hours, mins, secs);
|
||||
}
|
||||
|
||||
void replace_all(std::string& str, const std::string& old_value, const std::string& new_value) {
|
||||
static void replace_all(std::string &str, const std::string &old_value, const std::string &new_value) {
|
||||
if (old_value.empty())
|
||||
return;
|
||||
size_t start_pos = std::string::npos;
|
||||
size_t start_pos = 0;
|
||||
while ((start_pos = str.find(old_value, start_pos)) != std::string::npos) {
|
||||
str.replace(start_pos, old_value.length(), new_value);
|
||||
start_pos += new_value.length(); // In case 'new_value' contains 'old_value', like replacing 'x' with 'yx'
|
||||
|
|
Loading…
Reference in a new issue