String.Format("{0:n}", 1234); // Output: 1,234.00
String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876
More Related Contents:
- Parse C# string to DateTime
- Making a List in C# with three flexible elements in one datatype
- How can I convert String to Int?
- How do I get a consistent byte representation of strings in C# without manually specifying an encoding?
- In C#, should I use string.Empty or String.Empty or “” to intitialize a string?
- C# string replace does not actually replace the value in the string [duplicate]
- Easiest way to read from and write to files
- Easiest way to split a string on newlines in .NET?
- Calling a function from a string in C#
- How do I replace the *first instance* of a string in .NET?
- Convert a list to a string in C#
- Are there any Fuzzy Search or String Similarity Functions libraries written for C#? [closed]
- Get the index of the nth occurrence of a string?
- Replace multiple characters in a C# string
- Is there a C# case insensitive equals operator?
- Characters in string changed after downloading HTML from the internet
- Getting hash of a list of strings regardless of order
- Memory Efficiency and Performance of String.Replace .NET Framework
- Easier way of writing null or empty?
- How can I get a character in a string by index?
- What is the difference between .Equals and == [duplicate]
- What’s a good way of doing string templating in .NET?
- How does StringBuilder work internally in C#?
- Is there a “String.Format” that can accept named input parameters instead of index placeholders? [duplicate]
- Convert binary string into integer
- DateTime conversion from string C#
- How can I Unescape and Reescape strings in .net?
- Why only literal strings saved in the intern pool by default?
- Checking for null before ToString()
- splitting a string based on multiple char delimiters