Skip to content

Empty strings in result of "abc".split("") #33882

Closed
@frewsxcv

Description

@frewsxcv
fn main() {
    println!("{:?}", ("abc".to_owned()).split("").collect::<Vec<_>>());
}
["", "a", "b", "c", ""]

Is this expected behavior? If so, it should probably be documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions