Skip to content

split() loses final part if it’s empty #627

Closed
@danielparks

Description

@danielparks

I ran into a few bugs:

Regex Text Limit Expected Actual Notes
"-" "a" none ["a"] ["a"]
"-" "a-" none ["a", ""] ["a"] incorrect
"-" "a--" none ["a", "", ""] ["a", ""] incorrect
"-" "a" 2 ["a"] ["a", ""] #521
"-" "a-" 2 ["a", ""] ["a", ""]
"-" "a--" 2 ["a", "-"] ["a", "-"]

See also #521: splitn incorrectly returns a trailing "" if there is one fewer part than the limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions