位置:悠悠网 >> 网络日志 >> 编程设计
.net中,数字三位加逗号

作者: yoyo    阅读: 次     发布: 2008-5-17 1:09:19

using   System;  
using   System.Text.RegularExpressions;   
    
class   FormatNumber  
  {  
  public   static   void   Main()  
  {  
  string   str   =   "3453456456352";  
  Regex   r   =   new   Regex("\\d{3}",   RegexOptions.RightToLeft);  
  MatchCollection   mc   =   r.Matches(str);  
  for(int   i=0;   i<mc.Count;   i++)  
  {  
         str   =   str.Insert(mc[i].Index,   ",");  
  }  
         Console.WriteLine(str);  
  }  
   
  }

此文引自:internet
评注本文】 【更多相关】 【所有BLOG】 【打印文本】 【关闭窗口
 
WelCome To My Taobao Store!