Convert Byte Array Represented as String to Byte Array Golang
I have a byte array represented in the form of a string like so:
inputString := "[16 2 26 25 82 101 108 101 97 115 101 32 97 114 116 105 102 97 99 116 115 32 102 101 116 99 104 101 100 32 60 42 6 8 149 188 185 251 5]"
I wish to be able to convert this string into an array of bytes exactly the way it's represented:
desiredResult := []byte{16, 2, 26, 25, 82, 101, 108, 101, 97, 115, 101, 32, 97, 114, 116, 105, 102, 97, 99, 116, 115, 32, 102, 101, 116, 99, 104, 101, 100, 32, 60, 42, 6, 8, 149, 188, 185, 251, 5}
How can I do this in Golang?
from Recent Questions - Stack Overflow https://ift.tt/3kMtPSw
https://ift.tt/eA8V8J
Comments
Post a Comment