C#中如何在数字中插入逗号,如130000,变成130,000
C#中如何在数字中插入逗号,如130000,变成130,000   
 20000.124587   变成   20,000.124578   
 有简单的函数实现这个功能吗?
------解决方案--------------------lz也太懒惰了吧。。。 	 回复人:bestshl(快乐的Coder) 给你答案了,你怎么就不自己思考一下呢
------解决方案--------------------double MyDouble = 130000;           
 Console.WriteLine(MyDouble.ToString( "C ")); 
------解决方案--------------------String tmp =  "30000000000400000000003000000000020000000 "; 
 int pos = 3; 
 while( pos   < tmp.Length() ) 
 { 
     tmp.Insert(pos,  ", "); 
     pos+= 4; 
 } 
------解决方案--------------------using System; 
 class testsplit 
 { 
     static void Main(string[] args) 
     { 
         //20000.124587 变成 20,000.124578 
         string a =  "20000.124587 "; 
         string[] b = a.Split( '. '); 
         string c = b[0]; 
         char[] d = c.ToCharArray(); 
         string e =  " "; 
         for(int i=0;i <d.Length;i++) 
         { 
             e += d[i].ToString(); 
             if((d.Length-i-1)%3==0&&i!=d.Length-1) 
                 e +=  ", "; 
         } 
         string f = e+ ". "+b[1]; 
         Console.WriteLine(f); 
     } 
 }
------解决方案--------------------double var=1111112.12312312; 
         string[] str=var.ToString().Split( '. '); 
         string result= " "; 
         result=long.Parse(str[0]).ToString( "#,##0 "); 
         if(str.Length==2) 
             result+= ". "+ str[1]; 
         return result;
------解决方案--------------------decimal tmp1=5.984; 
 decimal tmp2=65183.1568; 
 decimal tmp3=549.189;   
 string stmp1=tmp1.ToString( "#,##0.00;-#,##0.00;- ");//在中间加分号的目的为正数;负数;零 
 string stmp2=tmp2.ToString( "¥ #,##0.00;¥ -#,##0.00;-   ");//同上,与标准的货币表示方法显示的结果基本一致。 
 string stmp3=tmp3.ToString( "F ");//标准格式化符号 
 string stmp4=tmp1.ToString( "C ");//标准的货币表示方法。