Skip to content

split_str includes the splitter substring, conflicting with the documentation #210

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

Open
owenthewizard opened this issue May 13, 2025 · 0 comments

Comments

@owenthewizard
Copy link

Each element yielded is guaranteed not to include the splitter substring.

use bstr::ByteSlice;

fn main() {
    let my_str = b"Hello ";
    let mut iter = my_str.split_str(b" ");
    assert_eq!(iter.next(), Some(b"Hello".as_ref()));
    assert_eq!(iter.next(), None);
}
thread 'main' panicked at src/main.rs:7:5:
assertion `left == right` failed
  left: Some([])
 right: None
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

No branches or pull requests

1 participant