Standard library / strings
strings.Contains()
Reports whether the literal sequence occurs anywhere, including an empty search sequence. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func Contains(s, substr string) boolParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
| substr | string | Substring to search for. |
Return Value
bool
Reports whether the literal sequence occurs anywhere, including an empty search sequence.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { fmt.Println(strings.Contains("café", "fé"))}