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

feat: add string/base/replace-after-last #1365

Merged
merged 14 commits into from
Feb 27, 2024
Merged

feat: add string/base/replace-after-last #1365

merged 14 commits into from
Feb 27, 2024

Conversation

AuenKr
Copy link
Contributor

@AuenKr AuenKr commented Feb 24, 2024

Resolves #814 .

Description

What is the purpose of this pull request?

This pull request:

  • adding a utility to replace the substring after the last occurrence of a specified search string.

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. Utilities Issue or pull request concerning general utilities. labels Feb 24, 2024
@kgryte kgryte changed the title feat: add @stdlib/string/base/replace-after-last feat: add string/base/replace-after-last Feb 24, 2024
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Feb 24, 2024
@kgryte
Copy link
Member

kgryte commented Feb 25, 2024

@AuenKr Similar to #1363, would you mind updating to support a fromIndex?

@AuenKr
Copy link
Contributor Author

AuenKr commented Feb 25, 2024

I am working on it along with replace-before-last

@kgryte kgryte removed the Needs Changes Pull request which needs changes before being merged. label Feb 25, 2024
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @AuenKr. Same concerns as replace-before-last regarding the handling of fromIndex when the value exceeds the last string index.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Feb 25, 2024
AuenKr and others added 4 commits February 26, 2024 22:38
…ark/benchmark.js

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
…epl.txt

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
AuenKr and others added 6 commits February 26, 2024 22:50
…ypes/index.d.ts

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
…est.js

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
…ypes/index.d.ts

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
…in.js

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
…in.js

Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Golden <103646877+AuenKr@users.noreply.github.com>
Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

Let's land this PR; thanks for your contribution and addressing the flagged points!

…ypes/index.d.ts

Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
@Planeshifter Planeshifter merged commit 58bdac8 into stdlib-js:develop Feb 27, 2024
7 checks passed
@Planeshifter Planeshifter removed the Needs Review A pull request which needs code review. label Mar 26, 2024
kgryte added a commit that referenced this pull request Apr 6, 2024
BREAKING CHANGE: resolve negative index arguments relative to last index

Previously, a negative `fromIndex` argument would resolve to `0`.
The current behavior resolves relative to the last character index.
To preserve the previous behavior, users should clamp index arguments
to index bounds before calling `replaceAfterLast`.

Ref: #1365
Ref: 58bdac8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. Needs Changes Pull request which needs changes before being merged. Utilities Issue or pull request concerning general utilities.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Add @stdlib/string/base/replace-after-last
3 participants