Skip to content

String.split omits final empty string(s) for trailing pattern #1178

@sin-ack

Description

@sin-ack

Reproduced in 0.29.0.

Reproducer:

// Expected: List("", "c", "", "")
// Got: List("", "c")
"abcababab".split("ab")
// Works as expected: List("", "1")
".1".split(".")
// Expected: List("", "1", "")
// Got: List("", "1")
".1.".split(".")

Empty strings will be omitted from the end no matter how many times you repeat the pattern.

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