aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2026-03-11 15:22:55 -0400
committerAlan Donovan <adonovan@google.com>2026-03-12 10:56:55 -0700
commit0dc89195f9aece70476320be3fc9d6d657904056 (patch)
treed72a1c41306f80bc40b44d5474160bf4c92d4e5b /src/strings
parent9e2189ef8e04d2745d18ac870ae54dcdcbc008db (diff)
downloadgo-0dc89195f9aece70476320be3fc9d6d657904056.tar.xz
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/strings')
-rw-r--r--src/strings/strings.go1
1 files changed, 1 insertions, 0 deletions
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
}