0

Suppose there is a number like

333987.67

I want to format only the integer part irrespective of decimal part, how long the decimal part will be it can be upto 10 digit also Like

333,987.67

No rounding nothing. How to do that? Do i have to split the decimal and integer part using "."

user3138879
  • 183
  • 2
  • 9
  • 2
    http://stackoverflow.com/questions/105770/net-string-format-to-add-commas-in-thousands-place-for-a-number – kcwu Mar 27 '15 at 06:34
  • You tostring using the correct format https://msdn.microsoft.com/en-us/library/fzeeb5cd%28v=vs.110%29.aspx – Allan S. Hansen Mar 27 '15 at 06:35

1 Answers1

0

You can use String.Format Below is the example

String.Format("{0:#,##0.00}", 400000)

output is: "4,00,000.00"

Here is the MSDN link

Shrivallabh
  • 2,863
  • 2
  • 27
  • 47
  • 5689.6786543. By using your example it will return 5,689.68. I want 5,689.6786543 – user3138879 Mar 27 '15 at 06:44
  • You need to increase the '0' after decimal to get the exact precision. ex:String.Format("{0:#,##0.0000000000}", 5689.6786543). Or take only integer part of the number and work on it. – Shrivallabh Mar 27 '15 at 06:56