Standard library / strings

strings.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(s, chars string) bool

Parameters & Attributes

NameTypeDescription
sstringInput text or sequence.
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 (  "fmt"  "strings")
func main() {  fmt.Println(strings.ContainsAny("café", "éx"))}
Go Reference