Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

display number with commas and decimal points

Tags:

c#

asp.net

I want to display a number with commas and decimal point

CASE1 : example if the number is 3494309432324

display as 34,94,30,94,32,324 but not 34,94,30,94,32,324.00

Case 2 : if the number has decimal values them till 2 decimal points and with commas

display as 12,22,222.32

currently i do this for 2 decimal places but i dont get the commas

Label9.Text = sisRatio.ToString("#0.00");

any suggestions..

thanks

like image 217
user175084 Avatar asked Nov 23 '09 17:11

user175084


People also ask

How do you put commas and dots around numbers?

Using Commas in Numbers (US, UK, and China) In the US, UK, and China, a comma is placed every 3 decimal places for numbers larger than 999. The decimal point is shown with a period (full stop).

How do you use a comma with decimals?

And in countries where a point is used as a decimal separator, a comma is usually used to separate thousands. So, for example, twelve thousand five hundred with a decimal of five zero is written differently depending on the country: In the USA, Mexico, or the UK, it would be written: 12 500.50 or 12,500.50.

Does Australia use commas in numbers?

Difference exist, even when the same language is spoken. Canada is particularly tricky: Quebec uses the system in France (no commas for large numbers with commas for small numbers) while the rest of Canada uses the method popular in Australia (no commas for large numbers with decimals for small numbers).

How do you write place value and decimal values?

The first digit after the decimal represents the tenths place. The next digit after the decimal represents the hundredths place. The remaining digits continue to fill in the place values until there are no digits left.


1 Answers

Assuming you want the usual 3 numbers then a comma, I think this will do what you need:

Label9.Text = sisRatio.ToString("#,##0.##");

One slight issue with this is that it will only one decimal place if the second one would be 0

like image 132
JDunkerley Avatar answered Sep 21 '22 01:09

JDunkerley