Using the Luhn algorithm to validate credit cards(ytechie.com)

submitted by SuperJasonSuperJason(2740) 3 years, 9 months ago

The right way to do credit card validation with the Luhn algorithm. Just as easy as regular expressions, but with stronger validation. This is a step-by-step guide to get it working in 10 minutes or less.

4 comments |category: |Views: 213

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by powerrushpowerrush(3873) 3 years, 9 months ago 0

Here is a VB.NET version of the Luhn algorithm (back when I had to code in VB.NET)...

http://www.dotnetkicks.com/vbnet/Credit_Card_Number_Validation_VB_Net_Function

Reply

posted by jdelatorjdelator(500) 3 years, 9 months ago 0

Thanks for giving me credit since you the post was inspired by my comment and not the post.

Reply

posted by jdelatorjdelator(500) 3 years, 9 months ago 0

It should read *since you know

Reply

posted by gregbeechgregbeech(76) 3 years, 9 months ago 0

Well really the best way to do it is with both regex and Luhn validation. Also, the fastest way to add up digits in a number is to use modulus-9, not to convert to a string then walking the chars converting them as you go...

Reply

information Login or create an account to comment on this story