سؤال

IS there any way, using the dataformatstring, to move the Euro (€) currency symbol to the beggining of the value without hardcoding the euro symbol in the xml?

Example : Using {0:C} I get 1234€ and what i want is to get €1234 . I can't find a solution for this without having to hardcode de euro symbol like €{0:g} .

Any clue ?

Regards

هل كانت مفيدة؟

المحلول

You need to set the CurrencyPositivePattern to 0:

NumberFormatInfo nfi = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
nfi.CurrencyPositivePattern = 0;

You will likely want to set the CurrencyNegativePattern as well. The link provides all of the patterns.

نصائح أخرى

It would seem safest to specify the default currency symbol.

As whatever your defualt culture is (e.g in case of French Currrency there is a dual currency either it can be the local currency or euros)

NumberFormatInfo numberFormatInfo= (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone(); numberFormatInfo.CurrencySymbol = "€";

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top