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) bool

Parameters & Attributes

NameTypeDescription
b[]byteByte sequence or second comparison input.
ffunc(rune) boolPredicate 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))}
Go Reference