]> Cypherpunks.ru repositories - gostls13.git/commit
bytes, strings: add Cut
authorRuss Cox <rsc@golang.org>
Tue, 21 Sep 2021 14:59:16 +0000 (10:59 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 6 Oct 2021 15:53:00 +0000 (15:53 +0000)
commit8e36ab055162efa6f67f3b9ee62f625ac8874901
treecf4109df9a5bdea03cc5a2fb25da85d2afd7ee73
parent810b08b8ec28ea00bce4c008f7c1b48bc9f3e134
bytes, strings: add Cut

Using Cut is a clearer way to write the vast majority (>70%)
of existing code that calls Index, IndexByte, IndexRune, and SplitN.
There is more discussion on https://golang.org/issue/46336.

Fixes #46336.

Change-Id: Ia418ed7c3706c65bf61e1b2c5baf534cb783e4d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/351710
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/bytes/bytes.go
src/bytes/bytes_test.go
src/bytes/example_test.go
src/strings/example_test.go
src/strings/strings.go
src/strings/strings_test.go