Cleaning up a whole bunch of stuff on my network and in archival storage. I am having major troubles converting all of my data, sources, documents, etc. to modern formats. Some of this stuff goes back to 1984 and earlier. Naturally, I am ditching tons of stuff. I am pretty much tossing all of my some thousand or so diskettes. Some of the disks have become unreadable after a decade or more of aging. Stuff that was once dreadfully important, like sources for various commercial products are being tossed because it's not worth the effort to sort through it all. Same goes for the million or so files on hard disks.
If I come across stuff like the below that can just be cut and pasted onto the net, I'll try to do so.
Here is a piece of code that might be useful to someone googling for credit card validation. Enjoy.
'Credit Card Validation Routine (Visual Basic) ' 'Copyright (c) Bob Trower, 2001 'This source code may be used as you wish, provided 'that these comments remain in the code. ' 'Returns True if the card number is valid, False otherwise 'Algorithm is the 'LUHN' formula specified in ANSI X4.13 'Last Digit of Card Number is the 'check digit'. 'From right to left, take value of check digit and add: ' double every second number and sum resulting digits. ' add the non-doubled digits. 'If the Credit Card Number is valid, the final sum 'will be an even multiple of ten ((x mod 10) = 0 ). Function IsValidCCNumber(CCNumber As String) As Integer Dim CheckSum As Integer Dim ThisDigit As Integer Dim i As Integer ' Note: Order of Steps is important... IsValidCCNumber = False ' Redundant in VB, but good practice If Len(CCNumber) > 10 Then ' Known Card numbers are more than 10 digits long CheckSum = Val(Mid(CCNumber, Len(CCNumber), 1)) 'Last Digit is CheckSum Digit For i = Len(CCNumber) - 1 To 1 Step -2 ThisDigit = Val(Mid(CCNumber, i, 1)) * 2 ' Double these digits CheckSum = CheckSum + (ThisDigit \ 10) + (ThisDigit Mod 10) ' Add the sum of the resulting digits Next For i = Len(CCNumber) - 2 To 1 Step -2 CheckSum = CheckSum + Val(Mid(CCNumber, i, 1)) ' Add these digits Next If CheckSum Mod 10 = 0 Then ' Resulting number should be an even multiple of 10 IsValidCCNumber = True End If End If End Function