Tutorial by Examples

The string type allows you to store text, which is a series of characters. There are multiple ways to create strings. A literal string is created by writing the text between double quotes. text := "Hello World" Because Go strings support UTF-8, the previous example is perfectly valid. ...
Package fmt implements functions to print and format text using format verbs. Verbs are represented with a percent sign. General verbs: %v // the value in a default format // when printing structs, the plus flag (%+v) adds field names %#v // a Go-syntax representation of the value %T...
strings.Contains fmt.Println(strings.Contains("foobar", "foo")) // true fmt.Println(strings.Contains("foobar", "baz")) // false strings.HasPrefix fmt.Println(strings.HasPrefix("foobar", "foo")) // true fmt.Println(strings.Has...

Page 1 of 1