Skip to content

strings: problem for strings.Split() #23534

Closed

Description

@iiinsomnia

if param s is an empty string, the result of strings.Split() should be an empty slice. But not now.

eg:

len(strings.Split("", ",")) // result: 1

Activity

  1. dominikh commented on Jan 24, 2018

    @dominikh
    Member

    Working as intended, and clearly documented:

    If s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s.

    Whether s itself is empty or not plays no role. This makes for a more robust API.

  2. changed the title [-]problem for strings.Split()[/-] [+]strings: problem for strings.Split()[/+] on Jan 26, 2018
  3. locked and limited conversation to collaborators on Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions