I just signed up my phone numbers on the National Do Not Call Registry. It's so easy to use, even your average Dennis Kucinich voter will probably be able to figure it out.
Amazingly, the website gives the following instruction for entering your phone number:
Enter phone numbers with or without a dash. Do not use spaces or periods.Now I know that the U.S. government can't always compete with, say, Microsoft, to attract the best and brightest software developers on the planet. But programmers who can't filter out spaces or periods?
Why not try this one line of perl code that will solve the entire problem:
$phone_number =~ s/[\.\s]//g; Yes, sometimes it really is that simple.Sadly, it ain't just the government. I see web forms all the time that can't deal with any format flexibility for numbers (phone numbers, credit card numbers, whatever)
The level of craftsmanship in programming has gotten pretty bad, to the point where I believe it is actually damaging to productivity.
Posted by: David Foster on October 10, 2003 07:51 AMAs someone who's written a couple of web pages to deal with this in the past, it can just be a documentation issue. I've written web pages that say things like "enter your credit card number without spaces," but then written my script so that if you do enter spaces, it works properly. This gives help to people who want direction ("wait, do I enter spaces here, or not?") but does the Right Thing for people who ignore the instructions.
Having just tested it, though, it looks like it refuses your entry if you use periods, though, which is stupid. Although I don't think your perl one-liner will help much (I'd recommend s/\D//g as a more flexible one, anyway) since they're running ASP on Windows 2000.
I've got an even easier line of code:
S PHNUM=$TR(PHNUM,"-/\ ","")
Which converts all "-/\ "'s into nothing.
Of couse, almost no one uses Mumps (Cache') for a web server. :(
Byna, got Mumps?
Posted by: Byna on October 12, 2003 03:19 PM