In .NET what is the best way to find the length of an integer in characters if it was represented as a string?
e.g.
1 = 1 character 10 = 2 characters
If you want to do it by maths you could try this:
int integer = 100 int charCount = (int) Math.Ceiling(Math.Log10(integer+1));
I doubt if this is very much faster than converting to a string though