• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Struct SepaIBAN

    Helper class for working with IBANs.

    Implements
    System.IComparable<SepaIBAN>
    System.IComparable
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Subsembly.Sepa
    Assembly: Subsembly.Sepa.dll
    Syntax
    public struct SepaIBAN : IComparable<SepaIBAN>, IComparable

    Constructors

    SepaIBAN(String)

    Wrap an IBAN given in its electronic format with a new SepaIBAN instance.

    Declaration
    public SepaIBAN(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN

    Complete IBAN that shall be wrapped by the new SepaIBAN instance. The IBAN must be given in its electronic format, i.e. it must not contain whitespace or symbol characters, and all letters must be upper case. If this parameter is null or an empty string, then this will be a NullIBAN. Use Capture(String) in order to pre-process a user entered IBAN.

    Remarks

    This constructor does not validate the given IBAN checksum, but it validates whether the given string looks like an IBAN using IsValid(String).

    Exceptions
    Type Condition
    System.ArgumentException

    The given IBAN string was no IBAN in its eletronic format (i.e. IsValid(String) returns false on it.

    SepaIBAN(String, String, String)

    Makes a new SepaIBAN by coercing the given parameters with a valid checksum.

    Declaration
    public SepaIBAN(string sCountryCode, string sBankCode, string sAcctNo)
    Parameters
    Type Name Description
    System.String sCountryCode

    The two letter country code of the country for which to generate the IBAN. This is not validated to be a real country code, and thus may be any string consisting of two upper case letters.

    System.String sBankCode

    Optional bank code portion of the IBAN to be made, including any leading zeroes. May be null or an empty string.

    System.String sAcctNo

    The complete account number portion of the IBAN to be made, including any leading zeroes. This must not be null and must not be an empty string.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sCountryCode or sAcctNo was null.

    System.ArgumentException

    The sCountryCode did not consist of two upper case characters, or, the sBankCode (if present) or sAcctNo did not consist solely of upper case characters and digits. Or the combined length did exceed the 34 character IBAN limit.

    Fields

    MAXLENGTH

    The maximum length of any IBAN in electronic format without IBAN prefix and without any symbols or whitespace is 34.

    Declaration
    public const int MAXLENGTH = 34
    Field Value
    Type Description
    System.Int32

    MINLENGTH

    The minimum length of any IBAN in electronic format without IBAN prefix and without any symbols or whitespace is 6.

    Declaration
    public const int MINLENGTH = 6
    Field Value
    Type Description
    System.Int32

    NullIBAN

    Represents an unset SepaIBAN instance.

    Declaration
    public static readonly SepaIBAN NullIBAN
    Field Value
    Type Description
    SepaIBAN

    Properties

    AcctNo

    Provides the branch and account number part of this IBAN, less any leading zeroes.

    Declaration
    public readonly string AcctNo { get; }
    Property Value
    Type Description
    System.String
    Remarks

    May be null, if it cannot be determined, because the IBAN structure is not known.

    BankCode

    Provides the bank identification code part of this IBAN, less any leading zeroes.

    Declaration
    public readonly string BankCode { get; }
    Property Value
    Type Description
    System.String
    Remarks

    May be null, if it cannot be determined, because the IBAN structure is not known.

    CountryCode

    Provides the country code portion of this IBAN.

    Declaration
    public readonly string CountryCode { get; }
    Property Value
    Type Description
    System.String

    IBAN

    Provides the wrapped IBAN in its electronic format. The value is null if this IBAN IsNull.

    Declaration
    public readonly string IBAN { get; }
    Property Value
    Type Description
    System.String

    IsNull

    Indicates whether this IBAN is the NullIBAN.

    Declaration
    public readonly bool IsNull { get; }
    Property Value
    Type Description
    System.Boolean

    IsSepaCompliant

    Indicates whether this IBAN belongs to a SEPA country and is not null.

    Declaration
    public readonly bool IsSepaCompliant { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    If this IsNull, then the value is false.

    Length

    Returns the actual length of this IBAN. If this IsNull, then zero is returned.

    Declaration
    public readonly int Length { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    Capture(String)

    Creates the electronic format IBAN representation from a given paper format IBAN.

    Declaration
    public static string Capture(string sPaperIBAN)
    Parameters
    Type Name Description
    System.String sPaperIBAN

    Paper format IBAN to be captured in electronic format. This may be prefixed with IBAN and may contain any number of blanks.

    Returns
    Type Description
    System.String

    Electronic format IBAN without blanks and without optional IBAN prefix. Any lower case characters have been converted to upper case. The result was not validated as an IBAN. It is up to the caller to validate the IBAN using IsValid(String) or other methods. The result may even be an empty string!

    If the parameter sPaperIBAN was null or an empty string, then the return value will be null.

    Remarks

    If the given paper IBAN starts with the prefix "IBAN", then this prefix is removed from the captured electronic IBAN.

    Any non alphanumeric characters, such as whitespace or symbols, are removed from the captured electronic IBAN.

    Any lower case letters are converted into upper case letters.

    See Also
    IsValid(String)

    CompareTo(SepaIBAN)

    Declaration
    public int CompareTo(SepaIBAN aOtherIBAN)
    Parameters
    Type Name Description
    SepaIBAN aOtherIBAN
    Returns
    Type Description
    System.Int32

    CompareTo(Object)

    Declaration
    public int CompareTo(object aObject)
    Parameters
    Type Name Description
    System.Object aObject
    Returns
    Type Description
    System.Int32

    Equals(Object)

    Compares the electronic IBAN representation for equivalence.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Right hand side to compare to.

    Returns
    Type Description
    System.Boolean

    True if both are essentially the same IBAN.

    Overrides
    System.ValueType.Equals(System.Object)

    Format()

    Formats this electronic format IBAN into a paper format IBAN.

    Declaration
    public string Format()
    Returns
    Type Description
    System.String

    Paper format IBAN. If this method is applied to the NullIBAN, then an empty string is returned.

    Remarks

    The paper representation of the IBAN is the same as the electronic format except that the IBAN is split up in groups of 4 characters separated by a space. The last group is variable in length, up to 4 characters.

    Capture(String)

    Format(String)

    Nicely formats the given IBAN input into groups of four IBAN characters.

    Declaration
    public static string Format(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN
    Returns
    Type Description
    System.String

    GetCountryCode(String)

    Returns the country code portion of the given IBAN.

    Declaration
    public static string GetCountryCode(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN

    Complete IBAN to extract the country code from. The IBAN must be given in its electronic format, i.e. it must not contain whitespace or symbol characters, and all letters must be upper case. Use Capture(String) in order to pre-process a paper format IBAN. This parameter may be null.

    Returns
    Type Description
    System.String

    If the parameter was null, or an empty string, or an invalid IBAN, then null is returned. Otherwise the two letter country code is returned.

    GetGermanAcctNo(String)

    Extract the german account number from an IBAN.

    Declaration
    public static string GetGermanAcctNo(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN
    Returns
    Type Description
    System.String

    The german account number for a valid german IBAN or null otherwise.

    See Also
    SepaGermanIBAN

    GetGermanBankCode(String)

    Extract the german bank code (Bankleitzahl) from an IBAN.

    Declaration
    public static string GetGermanBankCode(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN
    Returns
    Type Description
    System.String

    The german bankcode for a valid german IBAN or null otherwise.

    See Also
    SepaGermanIBAN

    GetHashCode()

    Provides an hash code based on the electronic IBAN representation of this IBAN.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    Hashcode.

    Overrides
    System.ValueType.GetHashCode()

    IsValid(String)

    Tests whether a string is a valid IBAN in its electronic format.

    Declaration
    public static bool IsValid(string sIBAN)
    Parameters
    Type Name Description
    System.String sIBAN

    Complete IBAN to be checked. The IBAN must be given in its electronic format, i.e. it must not contain whitespace or symbol characters, and all letters must be upper case. This parameter must not be null. Use Capture(String) in order to pre-process a paper format IBAN.

    Returns
    Type Description
    System.Boolean

    If the given string is a valid IBAN, then true is returned. Otherwise false is returned. If the parameter sIBAN was null, then false is returned, too.

    Remarks

    The test first checks the string length (must be within MINLENGTH and MAXLENGTH), and whether the string consists solely of upper case alphanumeric characters. Then it checks whether the string starts with a two letter country code, followed by the two digits checksum. Also the checksum itself is verified. Finally it checks the length using all well known SepaIBANSpecs.

    Capture(String)

    ToString()

    Returns the electronic format of this IBAN.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    Electronic format of this IBAN.

    Overrides
    System.ValueType.ToString()

    TryCapture(String)

    Tries to Capture(String) an IBAN. If no valid IBAN was captured, then NullIBAN is returned.

    Declaration
    public static SepaIBAN TryCapture(string sPaperIBAN)
    Parameters
    Type Name Description
    System.String sPaperIBAN
    Returns
    Type Description
    SepaIBAN

    Operators

    Equality(SepaIBAN, SepaIBAN)

    Equality operator compares the electronic format of the IBAN.

    Declaration
    public static bool operator ==(SepaIBAN lhs, SepaIBAN rhs)
    Parameters
    Type Name Description
    SepaIBAN lhs
    SepaIBAN rhs
    Returns
    Type Description
    System.Boolean

    Inequality(SepaIBAN, SepaIBAN)

    Inequality operator compares the electronic format of the IBAN.

    Declaration
    public static bool operator !=(SepaIBAN lhs, SepaIBAN rhs)
    Parameters
    Type Name Description
    SepaIBAN lhs
    SepaIBAN rhs
    Returns
    Type Description
    System.Boolean

    Implements

    System.IComparable<T>
    System.IComparable
    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH