Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix surround substring to surround all substrings #212

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

mrjsj
Copy link
Contributor

@mrjsj mrjsj commented Feb 25, 2024

Proposed changes

Fixes #209

Types of changes

What types of changes does your code introduce to quinn?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Further comments

I changed the input.find-method to simply use input.replace in order to replace all occurrences of the keyword. It will also replace substrings inside words, which I'm not sure is intentional (see 3rd unit test). Should the substring only be surrounded if there are no alphabetical characters, or maybe no alphanumerical characters around it? I.e.

  • Current case:
    • rdd in spark rdd stuff would be surrounded: spark **rdd|| stuff
    • rdd in spark rddrdd stuff would be surrounded: spark **rdd||**rdd|| stuff
    • rdd in spark rdd123 stuff would be surrounded: spark **rdd||123 stuff
  • Alphabetical excluded:
    • rdd in spark rdd stuff would be surrounded: spark **rdd|| stuff
    • rdd in spark rddrdd stuff would not be surrounded: spark rdd stuff
    • rdd in spark rdd123 stuff would be surrounded: spark **rdd||123 stuff
  • Alphanumerical excluded:
    • rdd in spark rdd stuff would be surrounded: spark **rdd|| stuff
    • rdd in spark rddrdd stuff would not be surrounded: spark rddrdd stuff
    • rdd in spark rdd123 stuff would not be surrounded: spark rdd123 stuff

Copy link
Collaborator

@SemyonSinchenko SemyonSinchenko left a comment

Choose a reason for hiding this comment

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

LGTM

@MrPowers MrPowers self-requested a review February 26, 2024 17:33
Copy link
Owner

@MrPowers MrPowers left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

@MrPowers MrPowers merged commit a661769 into MrPowers:main Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update surround_substring to surround all substrings
3 participants