-2

I am converting a double value to currency string format and it gets converted string with pound symbol currency. Is it culture dependent?

user3428508
  • 73
  • 2
  • 10

3 Answers3

2

If you always want to use a a specific locale, which may be desirable if your server target is hosted in a different timezone, etc... ToString() can be supplied with a CultureInfo argument.

How to convert string to double with proper cultureinfo

If you want to tailor it to the user's locale, You might be able to examine the request values:

Get CultureInfo from current visitor and setting resources based on that?

drone6502
  • 433
  • 2
  • 7
0

This probably isn't the best/most efficient way to do this, but have the decimal you want to show pounds converted into a string and just replace the dollar sign with the pound sign

decimal monies = 2.50m;
string moniesString = monies.ToString();
string moniesFormatted = string.Format("{0}£", moniesString);

again this most likely isn't the best or most efficient way to do so, but its a work around to avoid having to change your computer settings.

Hope this helps! If not let me know and I'll remove the answer(I had to use an answer because I can't comment under 50 rep, otherwise I would have used a comment to get some more clarity before answering) Cheers!

Chase
  • 81
  • 1
  • 7
-1
Control Panel > Region > Formats > Advanced

enter image description here

  • That would solve the problem.. expect it would cause **every** price on the OP's machine to use the pound sign, and wouldn't work when the application is accessed from another machine. Are you suggesting that the OP should have to do this for **every** virtual machine they intend to run the application on? – Obsidian Age Aug 10 '17 at 04:43