Standard library / bytes
bytes.ContainsFunc()
Reports whether the predicate accepts any decoded rune. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func ContainsFunc(b []byte, f func(rune) bool) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| b | []byte | Byte sequence or second comparison input. |
| f | func(rune) bool | Predicate over decoded runes. |
Return Value
bool
Reports whether the predicate accepts any decoded rune.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt" "unicode")
func main() { fmt.Println(bytes.ContainsFunc([]byte("a2"), unicode.IsDigit))}