Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork130
Fixed string::replace doesn't replace multiple occurrences of longer string with shorter one#200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: per1234 <accounts@perglass.com>
codecov-commenter commentedAug 30, 2023
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@## master #200 +/- ##======================================= Coverage 95.77% 95.77% ======================================= Files 13 13 Lines 970 970 ======================================= Hits 929 929 Misses 41 41
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Excellent work, thank you@PiotrekB416 🚀
@@ -652,9 +652,9 @@ void String::replace(const String& find, const String& replace) | |||
} | |||
} else if (diff < 0) { | |||
unsigned int size = len; // compute size needed for result | |||
diff = 0 - diff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ah, this line hurts 😉 . (Could it not beabs(diff)
? However, you did not commit this crime, simply moved the line to the right position 👍 .
This pr fixes
string::replace
not replacing multiple occurrences of longer string with shorter one.I also included unit tests from the issue
Thisfixes#199