Standard library / bytes

bytes.ContainsAny()

Reports whether any code point in chars occurs in the input; chars is a set, not a substring. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func ContainsAny(b []byte, chars string) bool

Parameters & Attributes

NameTypeDescription
b[]byteByte sequence or second comparison input.
charsstringSet of Unicode code points to match.

Return Value

bool

Reports whether any code point in chars occurs in the input; chars is a set, not a substring.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  fmt.Println(bytes.ContainsAny([]byte("café"), "éx"))}
Go Reference