2014-09-25 61 views

回答

2

我建议您检查Windows.Globalization.NumberFormatting命名空间,该命名空间提供了“根据用户的语言和地理区域提供用于格式化货币,十进制数,百分比值和permille值的类”。

在此link你可以找到一些例子中它的用法:

// Format with the user's default preferences. 
String decimalCurrent = decimalFormat.Format(randomNumber); 

//... 
results.AppendLine("Random number (" + randomNumber + ")"); 
results.AppendLine("With current user preferences: " + decimalCurrent); 
results.AppendLine("With grouping separators: " + decimal1); 
results.AppendLine("With grouping separators (fr-FR): " + decimalFR); 
results.AppendLine("With digit substitution (ar): " + decimalAR); 
+0

我无法在这里找到测量系统。但我需要这个。 – RenDishen 2014-09-26 10:41:01

0

你在测量?区域设置实际上太粗糙(一个给定的区域不一定与温度,液体体积,人体重量,物体重量对应于同一个系统),并且这些场景非常适合于应用程序。期望的是,这将是一个允许用户修改的应用程序设置。在大多数情况下,世界使用度量标准,并且可以将一组例外作为硬编码列表提供。您可以检查用户的HomeGeographicRegion以确定哪个列表为默认值,但仍应由用户覆盖。