I need to read [100]byte
to transfer a bunch of string
data.
Because not all of the string
s are precisely 100 characters long, the remaining part of the byte array
is padded with 0
s.
If I convert [100]byte
to string
by: string(byteArray[:])
, the tailing 0
s are displayed as ^@^@
s.
In C, the string
will terminate upon 0
, so what's the best way to convert this byte array
to string
in Go?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…