我想使用CurrencyFormatter根据其货币来格式化价格,但是结果字符串是意外的。在以下示例中,我希望结果字符串为₩123,456
:
var currencyFormat = new CurrencyFormatter("KRW"); //, new[] { "ko-KR" }, "KR");
var formatted = currencyFormat.Format(123456); // ₩123456
使用“老式”方式,将返回预期结果:
var formatted = 123456.ToString("C", new CultureInfo("ko-KR")); // ₩123,456
所以问题是:CurrencyFormatter
是否有理由省略分组字符,并且这种行为是否可以解决?
答案 0 :(得分:2)
您可以使用currencyFormat.IsGrouped = true;
属性来设置是否应将货币值的整数部分分组。试试这个,它对您有帮助;
using database
declare @queryString as nvarchar(max)
create table #tempTable (col1 int, col2 int, col3 int)
insert into #tempTable
select top 10 col1, col2, col3
from sometable
set @queryString='select * from #tempTable where col1>10'
exec(@queryString);