Advertisement
Jakobhorak28

Untitled

Oct 9th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.38 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.         }
  18.         static string getOutput(int valueInt)
  19.         {
  20.             double value = valueInt;
  21.             string output = "";
  22.             while (value >= 1000)
  23.             {
  24.                 output = output == "" ? "k" : output == "k" ? "M" : "G";
  25.                 value /= 1000;
  26.             }
  27.             if (value < 1)
  28.             {
  29.                 output = "m";
  30.                 value *= 1000;
  31.             }
  32.             value = (int)value / 100 > 0 ? Math.Round(value, 1) : (int)value / 10 > 0 ? Math.Round(value, 2) : Math.Round(value, 3);
  33.             output = value.ToString() + output;
  34.             return output;
  35.         }
  36.         static void getOutput(double value, out string output)
  37.         {
  38.             output = "";
  39.             while (value >= 1000)
  40.             {
  41.                 output = output == "" ? "k" : output == "k" ? "M" : "G";
  42.                 value /= 1000;
  43.             }
  44.             if (value < 1)
  45.             {
  46.                 output = "m";
  47.                 value *= 1000;
  48.             }
  49.             value = (int)value / 100 > 0 ? Math.Round(value, 1) : (int)value / 10 > 0 ? Math.Round(value, 2) : Math.Round(value, 3);
  50.             output = value.ToString() + output;
  51.         }
  52.         static string getOutput(double value)
  53.         {
  54.             string output = "";
  55.             while (value >= 1000)
  56.             {
  57.                 output = output == "" ? "k" : output == "k" ? "M" : "G";
  58.                 value /= 1000;
  59.             }
  60.             if (value < 1)
  61.             {
  62.                 output = "m";
  63.                 value *= 1000;
  64.             }
  65.             value = (int)value / 100 > 0 ? Math.Round(value, 1) : (int)value / 10 > 0 ? Math.Round(value, 2) : Math.Round(value, 3);
  66.             output = value.ToString() + output;
  67.             return output;
  68.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement