Struct SepaBIC
Helper class for working with SWIFT Addresses.
Inherited Members
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 |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The given BIC string was not a syntactically correct BIC (i.e.
IsValid(String) returns |
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
|
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 |
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
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 |
GetHashCode()
Provides an hash code based on the BIC11.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hashcode. |
Overrides
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 |
Returns
Type | Description |
---|---|
System.Boolean | If the parameter was |
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 |
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
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 |