1
我試過這種格式,得到了輸出1,234,567,890.00
分離十進制數在asp.net如逗號:1,23,456
但我需要這種格式
1,23,567
decimal unitPrice = 1234567890.00m;
TextBox1.Text = Convert.ToDecimal(unitPrice).ToString("##,#0.00");
我試過這種格式,得到了輸出1,234,567,890.00
分離十進制數在asp.net如逗號:1,23,456
但我需要這種格式
1,23,567
decimal unitPrice = 1234567890.00m;
TextBox1.Text = Convert.ToDecimal(unitPrice).ToString("##,#0.00");
我想你可以做到這一點爲您的需求創建一個自定義數字格式信息...示例在這裏供您參考 -
int yourNumber = 111234;
NumberFormatInfo nfo = new NumberFormatInfo();
nfo.CurrencyGroupSeparator = ",";
nfo.NumberGroupSizes = new int[] { 3, 2 };
string str = yourNumber.ToString("N0", nfo);
Response.Write("answer is : " + str);
其工作原理,感謝您的及時幫助! – Eliz
快樂完全是我的! –
需要幫助儘快!提前致謝 ! – Eliz
你已經得到逗號分隔的十進制數!你需要什麼? –