Standard library / bytes

bytes.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(b []byte, r rune) bool

Parameters & Attributes

NameTypeDescription
b[]byteByte sequence or second comparison input.
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 (  "bytes"  "fmt")
func main() {  fmt.Println(bytes.ContainsRune([]byte("سلام"), 'ل'))}
Go Reference