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

[stdlib] Add lstrip() and rstrip() to StringRef #2700

Open
wants to merge 7 commits into
base: nightly
Choose a base branch
from

Conversation

fknfilewalker
Copy link
Contributor

@fknfilewalker fknfilewalker commented May 17, 2024

lstrip and rstrip for StringRef, and delegates String.rstrip and friends to this StringRef implementation.

Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
@fknfilewalker fknfilewalker requested review from a team as code owners May 17, 2024 07:44
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
@JoeLoser
Copy link
Collaborator

Looks good, do you mind resolving the merge conflicts please and then ping me and I can import this PR? Thanks!

Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
@fknfilewalker
Copy link
Contributor Author

@JoeLoser

Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
@JoeLoser
Copy link
Collaborator

@JoeLoser

Thanks for the ping, I'll TAL when I'm by a laptop soon, likely later today.

Copy link
Collaborator

@JoeLoser JoeLoser left a comment

Choose a reason for hiding this comment

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

Want to add some explicit tests for StringRef with these functions?

@fknfilewalker
Copy link
Contributor Author

Want to add some explicit tests for StringRef with these functions?

I could copy the tests from string over, or do you have something better in mind?

@JoeLoser
Copy link
Collaborator

Want to add some explicit tests for StringRef with these functions?

I could copy the tests from string over, or do you have something better in mind?

I don't have anything better in mind, but I think that's what we've been doing with other recent PRs (although not consistently from a quick glance). It adds minimally more test coverage. What do you think?

In general, with all of this work in pushing String methods down to StringRef, maybe we should move a lot of String methods onto StringSlice instead, and on String have it internally take itself as a slice and do the operation? This was mentioned by @lsh offline the other day.

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.

None yet

2 participants