clear "0" on LCD when decrement.

Hello.
I looking for some smart solutions to clear "0" on my LCD when decrement value.

if ((*var == 9) || (*var == 99) || (*var == 999) || (*var == 9999)) lcd.print(" ");

I currently use something like that but its depending on var type and range. Earlier I just erase all digits but then i have to be careful to not erase other things and it also cause blinking my value.
So are there any better solutions that will not consume so much resources?

Thanks.

So are there any better solutions that will not consume so much resources?

Position the cursor. Print 4 spaces. Reposition the cursor. Print the 1 to 4 character string.

smarq8:
Hello.
I looking for some smart solutions to clear "0" on my LCD when decrement value.

if ((*var == 9) || (*var == 99) || (*var == 999) || (*var == 9999)) lcd.print(" ");

I currently use something like that but its depending on var type and range. Earlier I just erase all digits but then i have to be careful to not erase other things and it also cause blinking my value.
So are there any better solutions that will not consume so much resources?

Thanks.

use sprintf() to format the string using (you guessed it) Format Specifiers.

floats are not implemented on Arduino, but you can work around that very easily.

BulldogLowell:
floats are not implemented on Arduino, but you can work around that very easily.

This is not quite true.
Lack of floating point support in the xxprintf() routines is only an issue for the for the AVR processor.
The other processors do not have this limitation.
And it is not correct to state that it is not implemented, in reality it is just that by default it is not enabled.

The default for avr-gcc is to use a xxprintf() component that has floating point disabled.
You can override with a linker option. Unfortuantely, the IDE doesn't let you set this even when using a board with an AVR processor on it. But you can change a recipe in the platform file to use a different xxprintf() component that includes floating point support.

-- bill