From 0dc89195f9aece70476320be3fc9d6d657904056 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 11 Mar 2026 15:22:55 -0400 Subject: bytes,slices,strings: ContainsFunc: document short-circuit semantics I assume this was the intent but was not documented as an oversight. Change-Id: I2d62b8b28ed7bca0d935788a39579b13d6503624 Reviewed-on: https://go-review.googlesource.com/c/go/+/754242 LUCI-TryBot-Result: Go LUCI Reviewed-by: Austin Clements --- src/strings/strings.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/strings') diff --git a/src/strings/strings.go b/src/strings/strings.go index 28289a35bf..367e0a8e24 100644 --- a/src/strings/strings.go +++ b/src/strings/strings.go @@ -74,6 +74,7 @@ func ContainsRune(s string, r rune) bool { } // ContainsFunc reports whether any Unicode code points r within s satisfy f(r). +// It stops as soon as a call to f returns true. func ContainsFunc(s string, f func(rune) bool) bool { return IndexFunc(s, f) >= 0 } -- cgit v1.3-6-g1900