         return typeFromString(string) == type
     }
     
+    public func onlyNumbersFromString(string: String) -> String {
+        let set = NSCharacterSet.decimalDigitCharacterSet().invertedSet
+        let numbers = string.componentsSeparatedByCharactersInSet(set)
+        return "".join(numbers)
+    }
+    
     // MARK: - Loading data
-
+    
     private static let types = [
         [
             "name": "Amex",

    :returns: true or false
    */
    public func validateString(string: String) -> Bool {
        let numbers = string.onlyNumbers
        if count(numbers) < 9 {
            return false
        }


import Foundation

public class CreditCardValidator {
    
    public typealias T = CreditCardValidationType
    
    public lazy var types: [T] = {
        var types = [T]()
