Skip to content

String and Byte Array Conversion

To list items on your layout, we can use the column and row widgets to show mutiple child widgets.

Convert String to Bytes

bytes := []byte("Hello world")
fmt.Println(bytes) // [72 101 108 108 111 32 119 111 114 108 100]

Convert Bytes to String

bytes := []byte{72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100}
fmt.Println(string(bytes)) // Hello world
Back to top