Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int NumberOfDecimalPlaces(string number)
- {
- if (number.Contains(DecimalSymbol))
- {
- string[] numbersplit = number.Split(charDecimalSymbol);
- return numbersplit[1].ToString().Length;
- }
- else
- {
- return 0; //no decimal places.
- }
- }
- public static int NumberOfDecimalPlaces(int number)
- {
- return NumberOfDecimalPlaces(number.ToString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement