Standard library / reflect

reflect.Value.Len()

Return length of a string in bytes, or length of an array, slice, map, channel or pointer to array. Other kinds panic. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Len() int

Return Value

int

Return length of a string in bytes, or length of an array, slice, map, channel or pointer to array.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf("go").Len()) }
Go Reference