From your previous posts I know that the input is originally an 8 byte wide buffer.
So why not use that (or a 64-bit value build from that) to perform your operations?
That is how programming works: Operating on binary data.
Strings should be used only for human readable user output, not to perform operations.
An don't try to solve every problem using Qt. That is a C++ based tool to provide platform independent GUIs. When it is not GUI or string related, use plain C or C++.
With a 64-bit value, the solution is:
uint64_t val = getInputData(); if (val)
{
while (!(val & 0xff))
val >>= 8;
}