Standard library / strings

strings.ContainsRune()

Reports whether the input contains the requested Unicode code point; RuneError also matches invalid UTF-8. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func ContainsRune(s string, r rune) bool

Parameters & Attributes

NameTypeDescription
sstringInput text or sequence.
rruneUnicode code point.

Return Value

bool

Reports whether the input contains the requested Unicode code point; RuneError also matches invalid UTF-8.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strings")
func main() {  fmt.Println(strings.ContainsRune("سلام", 'ل'))}
Go Reference