Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Conversation

PiotrekB416
Copy link
Contributor

This pr fixesstring::replace not replacing multiple occurrences of longer string with shorter one.
I also included unit tests from the issue

Thisfixes#199

per1234
per1234 previously requested changesAug 30, 2023
@per1234per1234 added the bug labelAug 30, 2023
Co-authored-by: per1234 <accounts@perglass.com>
@per1234per1234 dismissed theirstale reviewAugust 30, 2023 21:16

Requested change has been made. Thanks!

@codecov-commenter
Copy link

Codecov Report

Patch coverage:100.00% and no project coverage change.

Comparison is base(50a27fb) 95.77% compared to head(12fb6ba) 95.77%.

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
Files ChangedCoverage Δ
api/String.cpp97.65% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

Copy link
Contributor

@aentingeraentinger left a 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;
Copy link
Contributor

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 👍 .

@aentingeraentinger merged commit2516a69 intoarduino:masterSep 4, 2023
@PiotrekB416PiotrekB416 deleted the Fix/string-replace-multiple-longer-by-shorter branchSeptember 4, 2023 17:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@aentingeraentingeraentinger approved these changes

@per1234per1234per1234 left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

String::replace doesn't work when replacing multiple occurencies of longer String by shorter one
4 participants
@PiotrekB416@codecov-commenter@aentinger@per1234

[8]ページ先頭

©2009-2025 Movatter.jp