Alex Rivera | Logout

format number in C#

Asked 2011-02-10T08:19:30.153
21

Possible Duplicate:
.NET String.Format() to add commas in thousands place for a number

How to format a number 1234567 into 1,234,567 in C#?

c#
Edit
Report

1 Answer

9
var decimalValue = 1234567m; 
var value =  String.Format("{0:N}", decimalValue); // 1,234,567.00

or without cents

var value =  String.Format("{0:N0}", decimalValue); // 1,234,567
answered 2011-02-10T08:23:56.237

Your Answer