diff options
| author | Alan Donovan <adonovan@google.com> | 2026-03-11 15:22:55 -0400 |
|---|---|---|
| committer | Alan Donovan <adonovan@google.com> | 2026-03-12 10:56:55 -0700 |
| commit | 0dc89195f9aece70476320be3fc9d6d657904056 (patch) | |
| tree | d72a1c41306f80bc40b44d5474160bf4c92d4e5b /src/bytes | |
| parent | 9e2189ef8e04d2745d18ac870ae54dcdcbc008db (diff) | |
| download | go-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/bytes')
| -rw-r--r-- | src/bytes/bytes.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 787ea86f00..98f78f10c3 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -89,6 +89,7 @@ func ContainsRune(b []byte, r rune) bool { } // ContainsFunc reports whether any of the UTF-8-encoded code points r within b satisfy f(r). +// It stops as soon as a call to f returns true. func ContainsFunc(b []byte, f func(rune) bool) bool { return IndexFunc(b, f) >= 0 } |
