gpt4 book ai didi

c# - 货币格式为 “£##,##0.00”

转载 作者:行者123 更新时间:2023-11-30 20:57:08 31 4
gpt4 key购买 nike

我需要货币格式为 “£##,##0.00”...使用这个但没有人在工作。

string str1 = string.Format("£##,##0.00", value);
string str3= String.Format("Order Total: {0:C}", value);
string str2 = string.Format("{0:$#,##0.00;($#,##0.00);''}", value);

最佳答案

使用 CultureInfo.CreateSpecificCulture() 可以设置文化信息,从而适应国家并使用适当的货币符号打印价格。

链接:http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.createspecificculture.aspx

decimal price = 9565.50m; 
string total = string.Format(CultureInfo.CreateSpecificCulture("en-GB"), "{0:C}", price);

关于c# - 货币格式为 “£##,##0.00”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17058673/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com