You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
golang-tutorial/demo/string01.go

21 lines
302 B

package main
import (
"fmt"
"os"
"strings"
)
func main() {
os.Setenv("Name", "Tinywan")
fmt.Println("Name = ", os.Getenv("Name"))
fmt.Println("Bar", os.Getenv("bar"))
fmt.Println()
fmt.Println()
for _, e := range os.Environ() {
pair := strings.Split(e, "=")
fmt.Println(pair[0])
}
}
go