EDDYMENS

Last updated 2024-02-11 22:09:12

How To Convert A String To A Byte Slice In Golang

Line 09 [→] shows the conversation of a "Hello, World!" string to byte. Very straightforward.

main.go

01: package main 02: 03: import ( 04: "fmt" 05: ) 06: 07: func main() { 08: str := "Hello, World!" 09: bytes := []byte(str) 10: 11: fmt.Println(bytes) 12: }

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"