‘[]byte(str)’
is used to convert a string to byte array.
Example
byteArray
:= []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
App.go
package main import ( "fmt" ) func main() { byteArray := []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ") fmt.Println(byteArray) }
Output
[65 66 67
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90]
No comments:
Post a Comment