我尝试了这种格式,输出为1,234,567,890.00
但我需要这种格式
1,23,567
decimal unitPrice = 1234567890.00m;
TextBox1.Text = Convert.ToDecimal(unitPrice).ToString("##,#0.00");
答案 0 :(得分:1)
我想您可以通过为您的需求创建自定义数字格式信息来实现此目的...示例供您参考 -
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);