mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
bytes, strings: document that FieldsFunc f must not be stateful
Fixes #8738. LGTM=adg R=golang-codereviews, adg CC=golang-codereviews https://golang.org/cl/143260045
This commit is contained in:
parent
ab76638cdc
commit
e9ec8e7a26
2 changed files with 4 additions and 0 deletions
|
|
@ -267,6 +267,8 @@ func Fields(s []byte) [][]byte {
|
|||
// It splits the slice s at each run of code points c satisfying f(c) and
|
||||
// returns a slice of subslices of s. If all code points in s satisfy f(c), or
|
||||
// len(s) == 0, an empty slice is returned.
|
||||
// FieldsFunc makes no guarantees about the order in which it calls f(c).
|
||||
// If f does not return consistent results for a given c, FieldsFunc may crash.
|
||||
func FieldsFunc(s []byte, f func(rune) bool) [][]byte {
|
||||
n := 0
|
||||
inField := false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue