Skip to content

Semantic of std::str::CharSplitsN and regex::RegexSplitsN don't match. #14899

Closed
@Kimundi

Description

@Kimundi

Both implement an Iterator over slices of a string that is being split at a pattern, but
std::str::CharSplitsN splits at most N times, yielding N + 1 strings; while regex::RegexSplitsN splits at most N - 1 times, yielding N strings.

This is inconsistent and confusing, and one of them should be changed to have the semantic of the other, however it is unclear which is the better one.

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