-
Notifications
You must be signed in to change notification settings - Fork 450
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
splitn(.., 2) returning extra substring #521
Comments
Closed
This was referenced Nov 18, 2019
BurntSushi
pushed a commit
that referenced
this issue
Jan 9, 2020
Corrects `/-/.split("a-")` to return `["a", ""]` instead of `["a"]`. (`/-/` is shorthand for `Regex::new("-").unwrap()`.) This adds tests for both `split()` and `splitn()` covering a variety of edge cases. One test is commented out because it is failing due to #521. A future commit will fix it. Note that the `split2` and `split3` tests were passing incorrectly before this change. I have fixed them to expect the correct values. Fixes #627
BurntSushi
pushed a commit
that referenced
this issue
Jan 9, 2020
Corrects `/-/.split("a-")` to return `["a", ""]` instead of `["a"]`. (`/-/` is shorthand for `Regex::new("-").unwrap()`.) This adds tests for both `split()` and `splitn()` covering a variety of edge cases. One test is commented out because it is failing due to #521. A future commit will fix it. Note that the `split2` and `split3` tests were passing incorrectly before this change. I have fixed them to expect the correct values. Fixes #627
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm seeing an extra substring produced by
splitn
in this code.I'd expect splitn(1), splitn(2), and splitn(3) to produce the same output, but splitn is returning an extra empty substring.
The text was updated successfully, but these errors were encountered: