public static IbanParts?Parse(string value) { if (value == null || !CheckLength(value)) { return(null); } string countryCode = CountryPart.FromIban(value); if (countryCode == null) { return(null); } string checkDigits = CheckDigitsPart.FromIban(value); if (checkDigits == null) { return(null); } string bban = BbanPart.FromIban(value); if (bban == null) { return(null); } return(new IbanParts(countryCode, checkDigits, bban, value)); }
public static Outcome <IbanParts> TryParse(string value) { if (value == null || !CheckLength(value)) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidIbanValue, value))); } string countryCode = CountryPart.FromIban(value); if (countryCode == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_CountryCode, value))); } string checkDigits = CheckDigitsPart.FromIban(value); if (checkDigits == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_CheckDigits, value))); } string bban = BbanPart.FromIban(value); if (bban == null) { return(Outcome <IbanParts> .FromError(Format.Current(Strings.InvalidInput_Bban, value))); } return(Outcome.Of(new IbanParts(countryCode, checkDigits, bban, value))); }