Beispiel #1
0
        public static void RemoveCurrencySpacing(this NumberFormatInfo @this)
        {
            Debug.Assert(@this != null);

            // If there is a space between the amount and the currency symbol, remove it.
            if (@this.CurrencyPositivePatternContainsSpace())
            {
                @this.CurrencyPositivePattern -= 2;
            }
            if (@this.CurrencyNegativePatternContainsSpace())
            {
                @this.CurrencyNegativePattern = SpaceReversedNegativePatterns[@this.CurrencyNegativePattern];
            }
        }
Beispiel #2
0
        public static void KeepOrAddCurrencySpacing(this NumberFormatInfo @this)
        {
            Debug.Assert(@this != null);

            // If there is no space between the amount and the currency symbol, add one.
            if ([email protected]())
            {
                // 0 "$n" is mapped to 2 "$ n".
                // 1 "n$" is mapped to 3 "n $".
                @this.CurrencyPositivePattern += 2;
            }
            if ([email protected]())
            {
                @this.CurrencyNegativePattern = SpaceReversedNegativePatterns[@this.CurrencyNegativePattern];
            }
        }