Skip to content

Conversation

@oscarotero
Copy link
Contributor

Hi again 👋

In this PR I've implemented the String.prototype.replaceAll function.

During the implementation I've discovered some bugs in String.prototype.replace that are also fixed, specifically:

  • The Rust's replace function works like replaceAll in javascript (replacing all occurrences). I've changed to replacen(search, replace, 1) to replace only the first occurence.
  • The position calculation was inversed (search.find(subject) instead of subject.find(search)).

Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

Some optimisations that can be made but looks absolutely good to me aside from a correctness standpoint. Let's make those changes and get this merged!

Thank you and great work! <3

@oscarotero oscarotero marked this pull request as ready for review October 7, 2024 17:05
@oscarotero
Copy link
Contributor Author

Thanks for the comments (every PR to nova is a masterclass of Rust for me). I hope it's okay now!

@load1n9 load1n9 requested a review from aapoalas October 7, 2024 17:25
load1n9
load1n9 previously approved these changes Oct 7, 2024
Copy link
Member

@load1n9 load1n9 left a comment

Choose a reason for hiding this comment

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

LGTM

aapoalas
aapoalas previously approved these changes Oct 8, 2024
Copy link
Member

@aapoalas aapoalas left a comment

Choose a reason for hiding this comment

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

LGTM! I'll merge this a bit later in case you want to make any changes based on my nitpicks.

@aapoalas aapoalas dismissed stale reviews from load1n9 and themself via 7afe34a October 9, 2024 10:20
@aapoalas aapoalas enabled auto-merge (squash) October 9, 2024 10:20
@oscarotero
Copy link
Contributor Author

@aapoalas thanks! Don't merge it yet. I'll make the changes, just need a bit more time (I'm busy right now)

@aapoalas
Copy link
Member

aapoalas commented Oct 9, 2024

@aapoalas thanks! Don't merge it yet. I'll make the changes, just need a bit more time (I'm busy right now)

Ah, alright! Don't worry about it <3

@aapoalas aapoalas disabled auto-merge October 11, 2024 06:22
@aapoalas aapoalas merged commit 21d412a into trynova:main Oct 12, 2024
1 check passed
@oscarotero oscarotero deleted the string/replaceall branch October 12, 2024 13:30
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.

3 participants