retesere20

c#-digits-after-dot-2

Jul 7th, 2019
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private int digitsAfterDot2(double value)
  2. {
  3. bool start = false;
  4. int count = 0;
  5. foreach (var s in value.ToString())
  6. {
  7. if (s == '.')
  8. start = true;
  9. else if (start)
  10. count++;
  11. }
  12. return count;
  13. }
RAW Paste Data