string - Clean up QByteArray from \0 -
I use Example, what I have to do: Earlier then my question - I I tested this code and it seems that Output: QByteArray in my app with fixed size of a byte record from binary data file I do read. Actually all of these records are wire if the string size is low record size, then the remaining bytes are filled with \ 0. Sometimes the record can start with \ 0.
\ 0 \ 0 \ 0t is \ 32 string \ 0 \ 0 \ 0 After
T that 32 string
QByteArray How can I clean from everyone?
QByteArray & amp; QByteArray :: Change (...) function.
QByteArray array; Array [0] = '\ 0'; Array [1] = 'A'; Array [2] = '\ 0'; Array [3] = 'b'; Array [4] = '\ 0'; QDebug () & lt; & Lt; "String:" & lt; & Lt; QString (array.toHex ()); Array.replace ('\ 0', ""); QDebug () & lt; & Lt; "String:" & lt; & Lt; QString (array.toHex ());
string: "0061006200" string: "6162"
Comments
Post a Comment