-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 split()
to StringRef
#2705
base: nightly
Are you sure you want to change the base?
Conversation
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <15105596+fknfilewalker@users.noreply.github.com>
Would it be better to first count the occurrence of the delimiter to properly reserve space? |
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 <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
Signed-off-by: Lukas Lipp <llipp@cg.tuwien.ac.at>
@@ -223,6 +223,47 @@ fn test_stringref_from_dtypepointer() raises: | |||
assert_equal(a, b) | |||
|
|||
|
|||
fn test_stringref_split() raises: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion Should we put this test in stdlib/test/builtin/test_stringref.mojo
instead?
Would this require two passes through the input string then? |
This PR adds a
split()
function toStringRef
and delegatesString.split()
to it