Advertisement
Jakobhorak28

Untitled

Oct 9th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. static void getOutput(int valueInt, out string output)
  2. {
  3.     double value = valueInt;
  4.     output = "";
  5.     while (value >= 1000)
  6.     {
  7.         output = output == "" ? "k" : output == "k" ? "M" : "G";
  8.         value /= 1000;
  9.     }
  10.     if (value < 1)
  11.     {
  12.         output = "m";
  13.         value *= 1000;
  14.     }
  15.     value = (int)value / 100 > 0 ? Math.Round(value, 1) : (int)value / 10 > 0 ? Math.Round(value, 2) : Math.Round(value, 3);
  16.     output = value.ToString() + output;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement