/// <summary>Converts the string to a BIC. /// A return value indicates whether the conversion succeeded. /// </summary> /// <param name="s"> /// A string containing a BIC to convert. /// </param> /// <param name="formatProvider"> /// The specified format provider. /// </param> /// <param name="result"> /// The result of the parsing. /// </param> /// <returns> /// True if the string was converted successfully, otherwise false. /// </returns> public static bool TryParse(string s, IFormatProvider formatProvider, out BankIdentifierCode result) { result = BankIdentifierCode.Empty; if (string.IsNullOrEmpty(s)) { return(true); } if (Qowaiv.Unknown.IsUnknown(s, formatProvider as CultureInfo)) { result = BankIdentifierCode.Unknown; return(true); } if (IsValid(s, formatProvider)) { result = new BankIdentifierCode() { m_Value = Parsing.ClearSpacingAndMarkupToUpper(s) }; return(true); } return(false); }
/// <summary>Converts the string to a BIC. /// A return value indicates whether the conversion succeeded. /// </summary> /// <param name="s"> /// A string containing a BIC to convert. /// </param> /// <param name="formatProvider"> /// The specified format provider. /// </param> /// <param name="result"> /// The result of the parsing. /// </param> /// <returns> /// True if the string was converted successfully, otherwise false. /// </returns> public static bool TryParse(string s, IFormatProvider formatProvider, out BusinessIdentifierCode result) { result = default; if (string.IsNullOrEmpty(s)) { return(true); } if (Qowaiv.Unknown.IsUnknown(s, formatProvider as CultureInfo)) { result = Unknown; return(true); } if (Pattern.IsMatch(s)) { result = new BusinessIdentifierCode(Parsing.ClearSpacingAndMarkupToUpper(s)); if (Country.TryParse(result.m_Value.Substring(4, 2)).IsEmptyOrUnknown()) { result = default; return(false); } return(true); } return(false); }