NedyalkoKikov

StringFormat

May 8th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace StringFormat
  8. {
  9. class StringFormat
  10. {
  11. static void Main()
  12. {
  13. int num = 123;
  14. Console.WriteLine(num.ToString("D6"));
  15. //in Hexadecimal:
  16. Console.WriteLine(num.ToString("X"));
  17. //Convert to char
  18. Console.WriteLine(Convert.ToChar(num));
  19. //Convert to string
  20. Console.WriteLine(Convert.ToString(num));
  21. Console.WriteLine("{0:C}",num);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment