无论所选语言/国家/地区如何,如何使Web应用程序仅显示美元货币?
SetCulture(string culture)
{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture);
}
Text = String.Format("{0:C}", item.TotCostDay);
答案 0 :(得分:1)
您可以尝试通过修改Clone
来创建当前文化的NumberFormat.Currency...
:
CultureInfo culture = CultureInfo.CurrentCulture.Clone() as CultureInfo;
CultureInfo usCulture = CultureInfo.GetCultureInfo("en-US");
// Dollar symbol - $
culture.NumberFormat.CurrencySymbol = usCulture.NumberFormat.CurrencySymbol;
// And (may be) some US currency patterns
culture.NumberFormat.CurrencyDecimalDigits = usCulture.NumberFormat.CurrencyDecimalDigits;
culture.NumberFormat.CurrencyPositivePattern = usCulture.NumberFormat.CurrencyPositivePattern;
culture.NumberFormat.CurrencyNegativePattern = usCulture.NumberFormat.CurrencyNegativePattern;
CultureInfo.CurrentCulture = culture;