Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
Last active January 22, 2024 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruanbekker/feaba5f99265f1d6fc24870772f42f21 to your computer and use it in GitHub Desktop.
Save ruanbekker/feaba5f99265f1d6fc24870772f42f21 to your computer and use it in GitHub Desktop.
Golang: Split strings by character
package main
import (
"fmt"
"os"
"strings"
)
func main() {
for _, envs := range os.Environ() {
pair := strings.Split(envs, "=")
fmt.Println("Key:", pair[0], "Value:", pair[1])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment