Example #1
0
        public string Build(ICurrencyFormat format)
        {
            var regexFormat = string.Empty;

            switch (format.CurrencyPattern)
            {
            case CurrencyPattern.Prefix: regexFormat = @"{1}{0}";
                break;

            case CurrencyPattern.Suffix: regexFormat = @"{0}{1}";
                break;

            case CurrencyPattern.PrefixSpace: regexFormat = @"{1}\s{0}";
                break;

            case CurrencyPattern.SuffixSpace: regexFormat = @"{0}\s{1}";
                break;

            default:
                break;
            }

            var regex = Build((INumericFormat)format);

            regex = regex.Remove(regex.Length - 1, 1).Remove(0, 1);
            var regexCurrency = string.Empty;

            foreach (char c in format.CurrencySymbol.ToCharArray())
            {
                regexCurrency += BuildCharCode(c);
            }
            regex = string.Format("^" + regexFormat + "$", regex, regexCurrency);

            return(regex);
        }
Example #2
0
        public string Build(ICurrencyFormat format)
        {
            var regexCurrency = string.Empty;

            switch (format.CurrencyPattern)
            {
            case CurrencyPattern.Prefix: regexCurrency = @"\{1}{0}";
                break;

            case CurrencyPattern.Suffix: regexCurrency = @"{0}\{1}";
                break;

            case CurrencyPattern.PrefixSpace: regexCurrency = @"\{1}\s{0}";
                break;

            case CurrencyPattern.SuffixSpace: regexCurrency = @"{0}\s\{1}";
                break;

            default:
                break;
            }

            var regex = Build((INumericFormat)format);

            regex = regex.Remove(regex.Length - 1, 1).Remove(0, 1);
            regex = string.Format("^" + regexCurrency + "$", regex, format.CurrencySymbol);

            return(regex);
        }
Example #3
0
        public string Build(ICurrencyFormat format)
        {
            var regexCurrency = string.Empty;
            switch (format.CurrencyPattern)
            {
                case CurrencyPattern.Prefix: regexCurrency = @"\{1}{0}";
                    break;
                case CurrencyPattern.Suffix: regexCurrency= @"{0}\{1}";
                    break;
                case CurrencyPattern.PrefixSpace: regexCurrency= @"\{1}\s{0}";
                    break;
                case CurrencyPattern.SuffixSpace: regexCurrency= @"{0}\s\{1}";
                    break;
                default:
                    break;
            }

            var regex = Build((INumericFormat)format);
            regex = regex.Remove(regex.Length - 1, 1).Remove(0, 1);
            regex = string.Format("^" + regexCurrency + "$", regex, format.CurrencySymbol);

            return regex;
        }
Example #4
0
 protected void Initialize(ICurrencyFormat currencyFormat)
 {
     Initialize((INumericFormat)currencyFormat);
     CurrencyPattern = currencyFormat.CurrencyPattern;
     CurrencySymbol  = currencyFormat.CurrencySymbol;
 }
Example #5
0
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal void ResetCurrency()
 {
     this._storeCurrency  = null;
     this._currencyFormat = null;
 }
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal static void ResetCurrency()
 {
     _storeCurrency = null;
     _currencyFormat = null;
 }
Example #7
0
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal void ResetCurrency()
 {
     this._storeCurrency = null;
     this._currencyFormat = null;
 }
Example #8
0
 protected void Initialize(ICurrencyFormat currencyFormat)
 {
     Initialize((INumericFormat)currencyFormat);
     CurrencyPattern = currencyFormat.CurrencyPattern;
     CurrencySymbol = currencyFormat.CurrencySymbol;
 }
Example #9
0
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal static void ResetCurrency()
 {
     _storeCurrency  = null;
     _currencyFormat = null;
 }