2

如果我知道文化,我可以知道货币名称和货币分数名称吗?

在“en-US”的情况下,它将是dollar& cent

我试图避免在数据库中创建映射。如果 asp.net 可以提供这些信息,我会很惊讶……可以吗?

PS:最终目标是——给个double赞78.54,我要seventy eight dollars and fifty four cents。而且我不想硬编码dollars&cents因为这应该与文化无关。

4

2 回答 2

2

.Net lacks number spell-out and currency fraction names.

于 2013-09-24T18:35:29.737 回答
-2
public static void Main() 
{
   RegionInfo ri = new RegionInfo("SE"); // Sweden

   Console.Clear();
   Console.WriteLine("Region English Name: . . . {0}", ri.EnglishName);
   Console.WriteLine("Native Name: . . . . . . . {0}", ri.NativeName);
   Console.WriteLine("Currency English Name: . . {0}", ri.CurrencyEnglishName);
   Console.WriteLine("Currency Native Name:. . . {0}", ri.CurrencyNativeName);
   Console.WriteLine("Geographical ID: . . . . . {0}", ri.GeoId);
}
/*
 This code example produces the following results:

 Region English Name: . . . Sweden
 Native Name: . . . . . . . Sverige
 Currency English Name: . . Swedish Krona
 Currency Native Name:. . . Svensk krona
 Geographical ID: . . . . . 221

*/

MSDN

于 2013-08-23T08:18:41.440 回答