Standard library / strings

strings.ContainsFunc()

Reports whether the predicate accepts any decoded rune. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func ContainsFunc(s string, f func(rune) bool) bool

Parameters & Attributes

NameTypeDescription
sstringInput text or sequence.
ffunc(rune) boolPredicate over decoded runes.

Return Value

bool

Reports whether the predicate accepts any decoded rune.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strings"  "unicode")
func main() {  fmt.Println(strings.ContainsFunc("a2", unicode.IsDigit))}
Go Reference