MVC Decimal Separator with multiple culture
I'm working with an application with multiple culture, and when i change culture 'pt' to 'en' the decimal separator chan开发者_StackOverflow中文版ge to. Have some way to fixing the decimal separator?
thanks.
Roll your own CultureInfo
by modifying the standard one:
var cInfo = CultureInfo.CreateSpecificCulture("en-us");
cInfo.NumberFormat.NumberDecimalSeparator = ",";
cInfo.NumberFormat.CurrencyGroupSeparator = ",";
cInfo.NumberFormat.PercentDecimalSeparator = ",";
Thread.CurrentThread.CurrentCulture = cInfo;
Thread.CurrentThread.CurrentUICulture = cInfo;
精彩评论