G
Guest
I require a function that takes a double as a parameter and returns the number of decimal places. What is the most efficient way in c# to find out the number of decimal places
I have written a function that does it by converting the double to a string. Is there a better way
public static int CountDecimalPlaces(double double1)
return double1.ToString().Substring(double1.ToString().IndexOf(".")+1).Length
Thank yo
I have written a function that does it by converting the double to a string. Is there a better way
public static int CountDecimalPlaces(double double1)
return double1.ToString().Substring(double1.ToString().IndexOf(".")+1).Length
Thank yo