If I have a number, how can I determine the number of decimals?
e.g. for 0.0001 I want to get the result 4
The duplicate suggested above is less suitable than this one because they are taking about culture-independent code but this question is just about decimal oriented code (i.e. after the decimal). So no need to introduce any more overhead:
Finding the number of places after the decimal point of a Double
but they both are good threads.