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); }
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); }
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; }
protected void Initialize(ICurrencyFormat currencyFormat) { Initialize((INumericFormat)currencyFormat); CurrencyPattern = currencyFormat.CurrencyPattern; CurrencySymbol = currencyFormat.CurrencySymbol; }
/// <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; }