Read Characters of String in Golang

Create new folder named src. In src folder, create new file named main.go as below:

package main

import (
	"fmt"
)

func main() {

	s := "abcDEF123"
	fmt.Println("Length: ", len(s))
	for i := 0; i < len(s); i++ {
		fmt.Printf("%5c", s[i])
	}

}




Open Terminal windows in Visual Studio Code and run command line: go run main.go

Length:  9
a    b    c    D    E    F    1    2    3