.Net lacks number spell-out and currency fraction names.
How to get currency FRACTION name?
-
26-06-2022 - |
Pregunta
If I know culture, can I know currency name and currency fraction name ?
In case of "en-US", it would be dollar
& cent
.
I am trying to avoid creation of mapping in database. I would be amazing if asp.net can provide this information... can it ?
PS: The ultimate goal is - given a double
like 78.54, I want seventy eight dollars and fifty four cents
. And I don't want to hard-code dollars
& cents
because this is supposed to be culture independent.
Solución
Otros consejos
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
*/
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow