Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

Conversation

hkubus
Copy link

@hkubus hkubus commented Jul 3, 2024

finishes 1 task off of #683

@hkubus
Copy link
Author

hkubus commented Jul 3, 2024

@microsoft-github-policy-service agree

Copy link
Member

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test with replacing a string with multiple characters?

@hkubus
Copy link
Author

hkubus commented Jul 3, 2024

Could you add a test with replacing a string with multiple characters?

Added, also found a bug where replaceAll could loop infinitely so fixed that as well.

@pelikhan
Copy link
Member

pelikhan commented Jul 3, 2024

what if searchvalue equals replace value?

@hkubus
Copy link
Author

hkubus commented Jul 3, 2024

i believe it shouldn't be an issue, that was part of the bug with replaceAll because if replaceValue contained searchValue it would just match against it forever.
Now, after replacing a match it only searches for the index after the position of the replacement value so it can't possibly match against the thing it just replaced. Should i add that as a test just in case anyways?

@pelikhan
Copy link
Member

pelikhan commented Jul 4, 2024

What if you replace "" with ""?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants