欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vc++ 格式化数字成3位3位显示

程序员文章站 2022-06-08 09:54:24
...
如题

 CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
			 NumberFormatInfo^ nfi = MyCI->NumberFormat;
			//  nfi->CurrencyDecimalDigits = 0; 
			nfi->NumberDecimalDigits = 0;
			// Displays a value with the default separator (S".").
			Int64 myInt = 12345678;
			nfi->CurrencyDecimalSeparator = ",";
			this->TB_Show->Text =  myInt.ToString( "N", nfi ) ;


以下代码未测试通过:
 String^ str = gcnew String("12345");
				 String^ res;
				 CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false );
				 NumberFormatInfo^ nfi = MyCI->NumberFormat;
				 nfi->CurrencyDecimalDigits = 0;
				 nfi->CurrencyDecimalSeparator = ",";
				 res = String::Format("###,#",str);
相关标签: vc++