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

    Class SwiftUtil

    Global utility methods.

    Inheritance
    System.Object
    SwiftUtil
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Subsembly.Swift
    Assembly: Subsembly.Sepa.dll
    Syntax
    public static class SwiftUtil

    Fields

    MAXCREDITCARDNOLENGTH

    The maximum length of a credit card number according to IsValidCreditCardNo(String).

    Declaration
    public const int MAXCREDITCARDNOLENGTH = 16
    Field Value
    Type Description
    System.Int32
    Remarks

    Actually the official length range for payment card numbers is 8 through 19 digits. But in real life all credit card numbers are between 12 and 16 digits. Hence this constant has the value 16.

    MINCREDITCARDNOLENGTH

    The minimum length of a credit card number according to IsValidCreditCardNo(String).

    Declaration
    public const int MINCREDITCARDNOLENGTH = 12
    Field Value
    Type Description
    System.Int32
    Remarks

    Actually the official length range for payment card numbers is 8 through 19 digits. But in real life all credit card numbers are between 12 and 16 digits. Hence this constant has the value 12.

    Methods

    AppendLuhn(String)

    Computes and appends a Luhn check digit to the given string.

    Declaration
    public static string AppendLuhn(string s)
    Parameters
    Type Name Description
    System.String s
    Returns
    Type Description
    System.String
    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter s was null.

    CoalesceSpaces(String)

    Declaration
    public static string CoalesceSpaces(string sText)
    Parameters
    Type Name Description
    System.String sText
    Returns
    Type Description
    System.String

    ComputeLuhn(String, Int32)

    Computes the Luhn check digit for the given string. The Luhn check is used, for example, with ISIN numbers and credit card numbers.

    Declaration
    public static char ComputeLuhn(string s, int n)
    Parameters
    Type Name Description
    System.String s

    The string to compute the Luhn check digit for. Must not be null.

    System.Int32 n

    The number of characters to include in the check digit computation. Only the first n characters are used when computing the check digit. If this is zero, then the check digit for an empty string, i.e. '0', will be returned. Must not be negative.

    Returns
    Type Description
    System.Char

    The computed check digit, which is in the range from '0' to '9'.

    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter s was null.

    System.ArgumentException

    The parameter n was negative.

    System.FormatException

    The parameter s contains invalid characters.

    IsValidCreditCardNo(String)

    Fully validates the given credit card number

    Declaration
    public static bool IsValidCreditCardNo(string sCreditCardNo)
    Parameters
    Type Name Description
    System.String sCreditCardNo
    Returns
    Type Description
    System.Boolean

    If the given string looks like a valid credit card number, then true is returned. If the parameter was null, an empty string or an otherwise invalid credit card number, then false is returned.

    Remarks

    Verifies the length, the character set and the Luhn check digit of the given credit card number. It does not verify the validity of the leading digits, yet.

    LuhnCheck(String)

    Computes and checks the check digits from the given string according to the Luhn algorithm. The Luhn check is used, for example, with ISIN numbers and credit card numbers.

    Declaration
    public static bool LuhnCheck(string s)
    Parameters
    Type Name Description
    System.String s

    The string to check. If this is null or empty, then the result will be false.

    Returns
    Type Description
    System.Boolean

    If the given string is correct accoring to the Luhn algorithm, then true is returned, otherwise false is returned.

    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH