If you have a number like 137, and you want to know how many digits it is composed:

var number = 137;
var nbrOfDigits = Math.Floor(Math.Log10(number) + 1);
//nbrOfDigits = 3