Answers for "length of struct golang"

Go
3

golang get string length

package main

import "fmt"

func main() {
    value := "cat"

    // Take length of string with len.
    length := len(value)
    fmt.Println(length)

    // Loop over the string with len.
    for i := 0; i < len(value); i++ {
        fmt.Println(string(value[i]))
    }
}
Posted by: Guest on June-10-2020

Code answers related to "length of struct golang"

Browse Popular Code Answers by Language