How to assign string to bytes array

I want to assign string to bytes array:

var arr [20]byte
str := "abc"
for k, v := range []byte(str) {
  arr[k] = byte(v)
}

Have another method?

1 Like

Safe and simple:

[]byte("Here is a string....")