currency code to symbol

G

Guest

If I have a currency code like "USD" or "EUR", how do I format a string from
a decimal value that would contain the correct currency symbol?

for example, if I have "USD" and 345.45, I want to see "$345.45", but if I
have "GBP" and 345.45 I want to see "345.45 [pound symbol here]".

I can see how you can start with a culture like en-US and get the output,
but I am starting only from a currency code.

thanks.
 
M

Mihai N.

If I have a currency code like "USD" or "EUR", how do I format a string
from
a decimal value that would contain the correct currency symbol?

for example, if I have "USD" and 345.45, I want to see "$345.45", but if I
have "GBP" and 345.45 I want to see "345.45 [pound symbol here]".

I can see how you can start with a culture like en-US and get the output,
but I am starting only from a currency code.
That info is not available in the CultureInfo, nor in the Win32 API.
You might need an external source for this info, like for instance CLDR
(http://www.unicode.org/cldr)
 
K

Kevin Yu [MSFT]

Yes, .NET framework itself didn't provide the ability to convert from
currency code to symbol. You can achieve this by either

1. Maintain a table that maps the code to symbol. Search this table every
time you need to do the conversion.
2. use a 3rd party component.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Hi,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top