Here is an elegant single line that does not use regex:
while (s.startsWith('0')) { s.remove(0,1); }
Not the fastest, but much faster than the regular expression version. Also, if you have C ++ 11, you can do something like this:
s.remove(0, std::distance(s.begin(), std::find_if_not(s.begin(), s.end(), [](QChar c) { return c == '0'; } )));
It's very fast.
Arlen source share