Re: Capitalizing the first letter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, March 13, 2007 9:10 am, Todd Cary wrote:
> I would like to write a filter that takes the text "smith" or
> "SMith" and returns "Smith"; same for "ralph smith".

No, you don't. :-)

You *think* you want to write that function, but this is one of those
things that is *way* more complicated than it seems to the beginner.

How about:

O'Brian
McCormick
Rodham-Clinton
von Freeman
del Castillo
.
.
.

> Is the a
> good source on using filters this way?

No.

You could, perhaps, compare the name you have with a list of common
names, and see if it is different only by case, and then prompt the
user to confirm that it is not a typo.

However, somewhere out there, there is some person who, for whatever
reason, *wants* to use SMith as their last name, and they are legally
entitled to do so, no matter how asinine it may seem.

Checking the name against a zillion names, and prompting the user is
probably more trouble than it's worth.

What *IS* a good idea is to give the user a second confirmation "look"
at the data before it goes in, and make them click a second time to
confirm that it is correct.

Most people will catch most of their mistakes if they actually look at
what they typed.

You won't get 100%, but you won't do any better with the zillion name
list check anyway, and this is a lot cheaper/easier/faster.

Human names are infinitely more complex than they seem at first glance.

Throw in artist/band names, and the complexity is squared.

E.g.,
The correct spelling of the lead singer from "disappear fear" is "SONiA"

I am not making this up as an example. This is for real.

http://www.disappearfear.com

And that's an easy one.

Don't even ask me to spell any rapper/hip-hop names!

PS
Every beginning programmer makes this mistake.

Some of us (me) were dumb enough to think we knew better than the
experienced folks saying "Don't do that".

We were wrong. :-)

Don't do that.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux