Currency format for display

前端 未结 7 1162
忘了有多久
忘了有多久 2020-11-27 06:50

Is there a way to format the correct currency representation for a country?

Example UK -£127.54 Netherlands € 127,54- USA $127.54

etc..

Some things to

相关标签:
7条回答
  • 2020-11-27 07:23

    This code- (sets currency to GB(Britain/UK/England/£) then prints a line. Then sets currency to US/$ and prints a line)

    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB",false);         
    Console.WriteLine("bbbbbbb   {0:c}",4321.2);
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US",false);
    Console.WriteLine("bbbbbbb   {0:c}",4321.2);
    

    Will display-

    bbbbbbb   £4,321.20
    bbbbbbb   $4,321.20
    

    For a list of culture names e.g. en-GB en-US e.t.c.
    http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.80).aspx

    0 讨论(0)
提交回复
热议问题