strings.ContainsRune() Function in Golang with Examples
The Unicode, which is a superset of ASCII and contains all the characters present in the world’s writing system, is the character set that’s being followed right now. Each character in the Unicode system is uniquely identified by a Unicode code point, which is referred to as runes in Golang. To know more about runes please go through the article Runes in Golang
strings.ContainsRune() Function in Golang is used to check the given string contains the specified rune or not in it.
Syntax:func ContainsRune(s string, r rune) bool
Here, str is the string and r is s rune.
It returns a boolean value true if the character specified by the rune is present in the string, else false.
The above code returns false as the character specified by the rune, or Unicode code point, 97, which is ‘a’, is not present in the string that is passed, “geeksforgeeks”.