Skip to content

strings: Index: confusing documentation #19039

@gtownsend

Description

@gtownsend

In the documentation of the function Index, in package strings:
(referencing https://golang.org/pkg/strings/#Index as of 11 Feb 2017)

I find the use of the identifier "sep", in the description of func Index, to be confusing. On first reading I interpreted it to mean that Index would find the first occurrence in s of any of a set of "separator" characters. I suggest renaming "sep" to "substr", which would be consistent with strings.Contains.

A similar argument would apply to strings.Count and strings.LastIndex. However, the use of "sep" in strings.Join is clear as currently written.

The several Split... functions could possibly also be clarified by changing the first mention of "sep" in the prose of each to "the substring sep".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions