QByteArray replace is a method in Qt C++ library which is responsible for replacing a portion of QByteArray object with another QByteArray object. Its syntax is:
QByteArray &QByteArray::replace(int pos, int len, const QByteArray &after)
where pos is the starting position of the segment to be replaced, len is the length of the segment to be replaced and after is the second bytearray object which would replace the first bytearray object.
Example:
QByteArray str("0123456789"); str.replace(3, 4, "ABCD"); // str now becomes "012ABCD56789"
This code replaces the segment from position 3 (inclusive) of 'str' with a length of 4 characters with "ABCD" segment.
Package library: Qt C++ library
C++ (Cpp) QByteArray::replace - 30 examples found. These are the top rated real world C++ (Cpp) examples of QByteArray::replace extracted from open source projects. You can rate examples to help us improve the quality of examples.