コード例 #1
0
ファイル: RegexBuilder.cs プロジェクト: ywscr/NBi
        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);
        }
コード例 #2
0
ファイル: RegexBuilder.cs プロジェクト: jansaris/NBi
        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);
        }
コード例 #3
0
ファイル: RegexBuilder.cs プロジェクト: Waltervondehans/NBi
        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;
        }
コード例 #4
0
 protected void Initialize(ICurrencyFormat currencyFormat)
 {
     Initialize((INumericFormat)currencyFormat);
     CurrencyPattern = currencyFormat.CurrencyPattern;
     CurrencySymbol  = currencyFormat.CurrencySymbol;
 }
コード例 #5
0
ファイル: CurrencyContext.cs プロジェクト: tompipe/Merchello
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal void ResetCurrency()
 {
     this._storeCurrency  = null;
     this._currencyFormat = null;
 }
コード例 #6
0
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal static void ResetCurrency()
 {
     _storeCurrency = null;
     _currencyFormat = null;
 }
コード例 #7
0
ファイル: CurrencyContext.cs プロジェクト: jlarc/Merchello
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal void ResetCurrency()
 {
     this._storeCurrency = null;
     this._currencyFormat = null;
 }
コード例 #8
0
ファイル: CurrencyFormatXml.cs プロジェクト: zyh329/nbi
 protected void Initialize(ICurrencyFormat currencyFormat)
 {
     Initialize((INumericFormat)currencyFormat);
     CurrencyPattern = currencyFormat.CurrencyPattern;
     CurrencySymbol = currencyFormat.CurrencySymbol;
 }
コード例 #9
0
 /// <summary>
 /// Clears the static field values.
 /// </summary>
 internal static void ResetCurrency()
 {
     _storeCurrency  = null;
     _currencyFormat = null;
 }