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

    Struct SepaBIC

    Helper class for working with SWIFT Addresses.

    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 SepaBIC

    Constructors

    SepaBIC(String)

    Wraps a BIC string within a SepaBIC.

    Declaration
    public SepaBIC(string sBIC)
    Parameters
    Type Name Description
    System.String sBIC

    The BIC to be wrapped. If this parameter is null or an empty string, then this will be a NullBIC. Use Capture(String) in order to pre-process a user entered BIC.

    Exceptions
    Type Condition
    System.ArgumentException

    The given BIC string was not a syntactically correct BIC (i.e. IsValid(String) returns false on it.

    Fields

    MAXLENGTH

    The maximum length of a valid BIC.

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

    MINLENGTH

    The minimum length of a valid BIC.

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

    NullBIC

    Represents an unset SepaBIC instance.

    Declaration
    public static readonly SepaBIC NullBIC
    Field Value
    Type Description
    SepaBIC

    Properties

    BIC

    Provides the wrapped BIC string. The value is null if this BIC IsNull.

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

    BIC11

    Provides the BIC with always 11 characters.

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

    If the BIC does not already consist of 11 characters, then it is padded with 'X' character before it is returned. If this is the NullBIC, then null is returned.

    CountryCode

    Provides the country code portion of this BIC.

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

    IsNull

    Indicates whether this BIC is the NullBIC.

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

    ShortBIC

    If the BIC consists of 11 characters and ends with XXX, then this returns only the first 8 characters of the BIC. Otherwise the full BIC is returned.

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

    TerminalCode

    If this BIC was extracted from a SWIFT adress, then this is the Terminal Code character from it. The field BIC always excludes the Terminal Code.

    Declaration
    public readonly char TerminalCode { get; }
    Property Value
    Type Description
    System.Char

    Methods

    Capture(String)

    Captures a BIC entered by the user, removing whitespace and converting lower case to upper case.

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

    If the parameter sBIC was null or an empty string, or contains only whitespace, then the return value will be null.

    Remarks

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

    Any lower case letters are converted into upper case letters.

    IsValid(String)

    Equals(Object)

    Compares the BIC11 value 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 the same basic BIC. Comparison is based on the possibly extended BIC11.

    Overrides
    System.ValueType.Equals(System.Object)

    GetCountryCode(String)

    Returns the country code from a BIC.

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

    Valid BIC from which the country code shall be extracted.

    Returns
    Type Description
    System.String

    If the given BIC was null, or an empty string, or an invalid BIC, then null is returned. Otherwise the 2-character country code extracted from the BIC is returned.

    GetHashCode()

    Provides an hash code based on the BIC11.

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

    Hashcode.

    Overrides
    System.ValueType.GetHashCode()

    IsValid(String)

    Checks whether a given BIC is valid.

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

    String that shall be checked for a BIC. May be null.

    Returns
    Type Description
    System.Boolean

    If the parameter was null, or an empty string, then false is returned. If the given string does not validate as a probable BIC, then false is returned, otherwise, true is returned.

    IsValidStrict(String)

    Checks whether this is a BIC that is strictly valid for international bank transfers.

    Declaration
    public static bool IsValidStrict(string sBIC)
    Parameters
    Type Name Description
    System.String sBIC
    Returns
    Type Description
    System.Boolean
    Remarks

    This method applies additional checks over IsValid(String) in order to reject testing codes and other sematic checks.

    ParseAddress(String)

    Parses a BIC from a 12 character SWIFT sddress.

    Declaration
    public static SepaBIC ParseAddress(string sSwiftAddress)
    Parameters
    Type Name Description
    System.String sSwiftAddress

    The 12 character SWIFT address.

    Returns
    Type Description
    SepaBIC
    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sSwiftAddress was null.

    System.ArgumentException

    The sSwiftAddress string was not a valid SWIFT address.

    ToString()

    Returns the complete SWIFT address.

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

    If this SepaBIC was constructed through ParseAddress(String), then the returned string includes the TerminalCode in its 9th position. Otherwise the return value is just the BIC. If this SepaBIC is actually null, then this methode returns an empty string.

    Overrides
    System.ValueType.ToString()

    TryCapture(String)

    Tries to Capture(String) a BIC. If no valid BIC was captured, then NullBIC is returned.

    Declaration
    public static SepaBIC TryCapture(string sPaperBIC)
    Parameters
    Type Name Description
    System.String sPaperBIC
    Returns
    Type Description
    SepaBIC

    Operators

    Equality(SepaBIC, SepaBIC)

    Equality operator compares the BIC11 values.

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

    Inequality(SepaBIC, SepaBIC)

    Inequality operator compares the BIC11 values.

    Declaration
    public static bool operator !=(SepaBIC lhs, SepaBIC rhs)
    Parameters
    Type Name Description
    SepaBIC lhs
    SepaBIC rhs
    Returns
    Type Description
    System.Boolean
    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH