문제

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