esendexdeveloper

How can you use a NumberFormat object to get the "pence" symbol for a culture, i.e. en-GB would give "p" and en-US would give "¡é". I've been looking through the class in visual studio and can't find anything relating to this, i've also gone through the different ToString() format methods and i can't find anything their either.

If you have an answer please reply here and drop a comment on my blog


Cheers



Re: Visual C# General NumberFormat object flaw?

H. Tony

I dont think number format can handle that, you need to write your own code to do that.







Re: Visual C# General NumberFormat object flaw?

esendexdeveloper

The problem with writing your own code to do it is if you want to add another currency to your table and they have a different symbol for their "pence", "cent" etc then it will require a code change to hard code the new symbol where as the cultureinfo object will handle any new cultures dynamically.

If the NumberFormat object can't do this then is there another way of getting the pence / cent symbol dynamically based on the users culture





Re: Visual C# General NumberFormat object flaw?

Peter Ritchie

Windows locale/culture only recognizes currency at the 100 level (i.e. dollars or pounds). You'll have to manage formatting cents at the application level.






Re: Visual C# General NumberFormat object flaw?

IsshouFuuraibou

I think because "pence" or cent symbol is an exception to the rule and not the standard. In many cases monetary systems don't have "pence" currency. For example the smallest denomination for the Japanese Yen is 1 Yen. This is true in many other currencies. You'll also see that in all cases where you have a "pence" symbol, you can also format it as "$"0.00. From what I've seen the culture info doesn't store the pence symbol.





Re: Visual C# General NumberFormat object flaw?

esendexdeveloper

Thanks for your answers, i suppose it makes sense when you think about cultures that don't have a "pence" denomination.