[SOLVED] String conversion
-
How can I convert an int with one or two digits into a String which has always two digits but if the int is negative the minus sign is in front of the two digits?
Example:
12 -> "12"
9 -> "09"
-12 -> "-12"
-9 -> "-09"Is there a smart function which does this, or need I to use an if-statement which converts first the absolute value of the int into a string -9 -> "09" and if the value was negative it prepents the minus sign to the string?
-
"QString::number()":http://doc.qt.nokia.com/latest/qstring.html#number
-
or maybe this: "http://doc.qt.nokia.com/latest/qstring.html#arg":QString::arg()
by specifying a fieldWith and fillChar