how do I find out the number of digits in a variable

i need a sprite to do increase its width based on the amount of digits in the variable