BTUIKUtil

Objective-C

@interface BTUIKUtil : NSObject

/// Checks if a card number is Luhn valid
///
/// @param cardNumber A string of numbers representing the card number
///
/// @return True ic the cardNumber is Luhn valid. False otherwise.
+ (BOOL)luhnValid:(NSString *)cardNumber;

/// Strips non-digit characters from a string.
///
/// @param input The string to strip.
///
/// @return The string stripped of non-digit characters, or `nil` if `input` is
/// `nil`
+ (NSString *)stripNonDigits:(NSString *)input;

/// Strips non-digit characters and '/' from a string.
///
/// @param input The string to strip.
///
/// @return The string stripped of non-digit characters and '/', or `nil` if `input` is
/// `nil`
+ (NSString *)stripNonExpiry:(NSString *)input;

@end

Swift

class BTUIKUtil : NSObject

Undocumented

  • Checks if a card number is Luhn valid

    Declaration

    Objective-C

    + (BOOL)luhnValid:(NSString *)cardNumber;

    Swift

    class func luhnValid(_ cardNumber: String!) -> Bool

    Parameters

    cardNumber

    A string of numbers representing the card number

    Return Value

    True ic the cardNumber is Luhn valid. False otherwise.

  • Strips non-digit characters from a string.

    Declaration

    Objective-C

    + (NSString *)stripNonDigits:(NSString *)input;

    Swift

    class func stripNonDigits(_ input: String!) -> String!

    Parameters

    input

    The string to strip.

    Return Value

    The string stripped of non-digit characters, or nil if input is nil

  • Strips non-digit characters and ‘/’ from a string.

    Declaration

    Objective-C

    + (NSString *)stripNonExpiry:(NSString *)input;

    Swift

    class func stripNonExpiry(_ input: String!) -> String!

    Parameters

    input

    The string to strip.

    Return Value

    The string stripped of non-digit characters and ‘/’, or nil if input is nil