docker files fixes from liaqat
This commit is contained in:
25
src/Managing.Core/MathHelpers.cs
Normal file
25
src/Managing.Core/MathHelpers.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Managing.Core
|
||||
{
|
||||
public static class MathHelpers
|
||||
{
|
||||
public static int GetDecimalPlaces(decimal n)
|
||||
{
|
||||
n = Math.Abs(n); //make sure it is positive.
|
||||
n -= (int)n; //remove the integer part of the number.
|
||||
var decimalPlaces = 0;
|
||||
|
||||
while (n > 0)
|
||||
{
|
||||
decimalPlaces++;
|
||||
n *= 10;
|
||||
n -= (int)n;
|
||||
}
|
||||
return decimalPlaces;
|
||||
}
|
||||
|
||||
public static int GetDecimalPlaces(string n)
|
||||
{
|
||||
return n.Split('.')[1].Length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user