len()
Try it yourself →Returns the number of bytes/elements.
Syntax
len(text)
Description
Returns the length of the text (in bytes) or the number of elements in a slice. Built-in (no import needed).
Example
package main
import "fmt"
func main() {
fmt.Println(len("merhaba"))
}Expected output
7
When to use?
Length check.