Coder Social home page Coder Social logo

rzubascu / creditcardcheck Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kiancheong/creditcardcheck

0.0 1.0 0.0 95 KB

CreditCardCheck is a Cocoa/Objective-C class to check for the validity of credit card numbers using the Luhn Algorithm.

Objective-C 50.55% Ruby 49.45%

creditcardcheck's Introduction

CreditCardCheck

CreditCardCheck is a Cocoa/Objective-C class to check for the validity of credit card numbers using the Luhn Algorithm.

Methods

All methods are Class methods. Just import the header file and you're good to go.

+ (NSString *)cleanCreditCardNo:(NSString *)aCreditCardNo; - Returns a cleaned up credit card no (ie. no spaces, dashes, etc.).

+ (NSString *)majorIndustryOf:(NSString *)aCreditCardNo; - Returns the major industry of the credit card. Based on the first digit.

+ (NSString *)issuerOf:(NSString *)aCreditCardNo; - Returns the issuer of the credit card.

+ (int)luhnCheckOf:(NSString *)aCreditCardNo; - Returns the computed no. based on the Luhn Algorithm. The last digit entered will always be assumed to be the check digit. Works with any length of numbers. So not really limited to credit card no.

+ (BOOL)validityOf:(int)aLuhnNo; - Just mod 10 the parameter. Returns YES if Luhn no. passed is divisible by 10.

Notes

Known Issues

  1. + (NSString *)issuerOf:(NSString *)aCreditCardNo; is not yet implemented. Looking for a complete up-to-date database of these.

Copyright & License

Copyright (c) 2012 Dexter Ang

CreditCardCheck is released under the MIT license:

creditcardcheck's People

Contributors

thepoch avatar

Watchers

Radu Zubascu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.