Another thing to consider is justification.
The other solutions above will solve the issue of not fully overwriting the previous characters,
however, they do left justification. This is not my preference for numbers that can be changing as
the base position of the 1's column is shifting location on the display.
For example, in your case, if you were to rotate the knob very quickly, the numbers
will potentially move left and right as the magnitude of the number changes.
i.e. when displaying 999 vs 1000 the 1 and 9 are landing in the same postion
but represent different magnitudes.
My preference is to right justify so that you have either leading spaces, or zeros
so that the magnitude digits remain in a fixed position.
If you don't want to use printf() you can also do this using the exiting Arduino Print class
functions, but it requires adding some code to check on the magnitude of the number and printing
extra spaces or zeros prior to printing the number to overwrite the positions that don't exist
for the about to be printed number.
example:
if(x < 1000)
lcd.print(" ");
if(x < 100)
lcd.print(" ");
if(x < 10)
lcd.print(" ");
lcd.print(x);
It is a bit clunky, which is why I prefer using printf() when code space allows.
--- bill