Advertisement
Chemdawg

Untitled

Jun 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. Coinbrawl, Long to String conversion. Display gold with names.
  2.  
  3. Input: string
  4. Output: string
  5.  
  6.     public static String GoldConverter(string gold)
  7.         {
  8.             var output = "";
  9.  
  10.             var lengte = gold.Length;
  11.  
  12.             if (lengte < 6)
  13.                 output = gold;
  14.  
  15.             if (lengte > 6 && lengte <= 9)
  16.                 output = (gold.Substring(0, gold.Length - 6) + "," + (gold.Substring(1, gold.Length - 5) + " Million"));
  17.  
  18.             if (lengte > 9 && lengte <= 12)
  19.                 output = (gold.Substring(0, gold.Length - 9) + "," + (gold.Substring(1, gold.Length - 8) + " Billion"));
  20.  
  21.             if (lengte > 12 && lengte <= 15)
  22.                 output = (gold.Substring(0, gold.Length - 12) + "," + (gold.Substring(1, gold.Length - 11) + " Trillion"));
  23.  
  24.             if (lengte > 15 && lengte <= 18)
  25.                 output = (gold.Substring(0, gold.Length - 15) + "," + (gold.Substring(1, gold.Length - 14) + " Quadrillion"));
  26.  
  27.             if (lengte > 18 && lengte <= 21)
  28.                 output = (gold.Substring(0, gold.Length - 18) + "," + (gold.Substring(1, gold.Length - 17) + " Quintillion"));
  29.  
  30.             return output;
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement