How to find the length of a string in Golang?

In Go, you can find the length of a string using the len() function. Here's an example:

package main import "fmt" func main() { str := "Hello, World!" length := len(str) fmt.Println("Length of the string:", length) }

Output:

Length of the string: 13

In this example, the len() function is used to find the length of the string "Hello, World!", and the result is stored in the length variable. Then, the length is printed using fmt.Println().