I have a variable of decimal type and I want to check the number of digits before decimal point in it. What should I do? For example, 467.45 should
decimal
467.45
Use modulo, i'm not a C# programmer, but I'm pretty sure this solution work:
double i = 1; int numberOfDecimals = 0; while (varDouble % i != varDouble) { numberOfDecimals++; i*=10; } return numberOfDecimals;