How to format numbers in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to format numbers in C#

Trying to display the number in a neat format but not sure how to achieve that // from int source = 2147483647; // to string target = "2,147,483,647"; Any answer is appreciated 👍

29th Aug 2021, 7:36 PM
Tim
Tim - avatar
3 Answers
+ 3
hello you can use just ToString() method for example target.ToString("000,000"); very easy and enjoy :X
19th Sep 2021, 4:27 PM
Behnam Sarraj
Behnam Sarraj - avatar
+ 1
Thank you
19th Sep 2021, 4:27 PM
Tim
Tim - avatar
0
thnx
29th Nov 2021, 8:56 AM
Shubham Bhatia
Shubham Bhatia - avatar