akiross
8th April 2011, 21:14
Hello,
I'm using QString::arg in a dynamical environment: string and arguments are unknown. So I've to replace the place markers as they come.
My problem is that I can get more arguments to replace than markers in the string, so it's probable I'm getting an error. The documentation says:
If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.
I don't need the warning message, but something I can handle in the code (value or exception). But being the result undefined in case of error, I don't know how to proceed.
Apart the brutal counting of "%X" in the string (which, again, is useless to count as my arguments are dynamic so the count may change in each substitution), is there a way to get an error/exception instead of that warning message?
Thanks.
~Aki
I'm using QString::arg in a dynamical environment: string and arguments are unknown. So I've to replace the place markers as they come.
My problem is that I can get more arguments to replace than markers in the string, so it's probable I'm getting an error. The documentation says:
If there is no unreplaced place marker remaining, a warning message is output and the result is undefined. Place marker numbers must be in the range 1 to 99.
I don't need the warning message, but something I can handle in the code (value or exception). But being the result undefined in case of error, I don't know how to proceed.
Apart the brutal counting of "%X" in the string (which, again, is useless to count as my arguments are dynamic so the count may change in each substitution), is there a way to get an error/exception instead of that warning message?
Thanks.
~Aki