mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 14:10:19 +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
e4cfe4ea0d
commit
51cf9e9d1c
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ static std::string video_time(int secs)
|
|||
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