summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bytes/bytes.go2
-rw-r--r--src/strings/strings.go2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
index 34c22bbfb..7634707b3 100644
--- a/src/bytes/bytes.go
+++ b/src/bytes/bytes.go
@@ -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
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 761f32a06..1b9df2e75 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -347,6 +347,8 @@ func Fields(s string) []string {
// FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c)
// and returns an array of slices of s. If all code points in s satisfy f(c) or the
// string is empty, 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 string, f func(rune) bool) []string {
// First count the fields.
n := 0