Length of string
- len
package main
import "fmt"
func main() {
a := "Hello"
la := len(a)
fmt.Printf("%v %v\n", a, la)
b := ""
lb := len(b)
fmt.Printf("%v %v\n", b, lb)
c := "Hello World!"
lc := len(c)
fmt.Printf("%v %v\n", c, lc)
}
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import "fmt"
func main() {
a := "Hello"
la := len(a)
fmt.Printf("%v %v\n", a, la)
b := ""
lb := len(b)
fmt.Printf("%v %v\n", b, lb)
c := "Hello World!"
lc := len(c)
fmt.Printf("%v %v\n", c, lc)
}