From: Daniel Martin Date: 2007-04-27T21:36:15+09:00 Subject: Re: [QUIZ] Checking Credit Cards (#122) Ruby Quiz writes: > This week's Ruby Quiz is to write a program that accepts a credit > card number as a command-line argument. The program should print > the card's type (or Unknown) as well a Valid/Invalid indication of > whether or not the card passes the Luhn algorithm. May I make an additional suggestion? Treat spaces in the card number as perfectly valid, and simply strip them before processing. One of the most irritating features found in many online stores is the requirement that the credit card number be typed in with no spaces. (The other biggie is using a select box for the state abbreviation) Now granted, for accepting the card number from the command line this will mean that on the command line the card number was quoted, but presumably most people's programs will be a command-line wrapper around a function/class that does the real work. -- s=%q( Daniel Martin -- martin@snowplow.org puts "s=%q(#{s})",s.to_a[1] ) puts "s=%q(#{s})",s.to_a[1]