diff options
| author | Emmanuel Odeke <emm.odeke@gmail.com> | 2016-04-07 23:22:30 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2016-04-08 20:24:57 +0000 |
| commit | 59af53d681845a8b0be2a728ca1b59aee5ad9ea6 (patch) | |
| tree | afa72e2301c2cda3ddcf4f9ecb73a90204c35dfa /src/bytes/bytes.go | |
| parent | 6c5352f181846b73d532c039df3017befe657d6a (diff) | |
| download | go-59af53d681845a8b0be2a728ca1b59aee5ad9ea6.tar.xz | |
bytes: add ContainsRune
Make package bytes consistent with strings
by adding missing function ContainsRune.
Fixes #15189
Change-Id: Ie09080b389e55bbe070c57aa3bd134053a805423
Reviewed-on: https://go-review.googlesource.com/21710
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/bytes/bytes.go')
| -rw-r--r-- | src/bytes/bytes.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 698d881c9d..305c85d9f4 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -88,6 +88,11 @@ func ContainsAny(b []byte, chars string) bool { return IndexAny(b, chars) >= 0 } +// ContainsRune reports whether the Unicode code point r is within b. +func ContainsRune(b []byte, r rune) bool { + return IndexRune(b, r) >= 0 +} + // Index returns the index of the first instance of sep in s, or -1 if sep is not present in s. func Index(s, sep []byte) int { n := len(sep) |
