February 12, 2009 at 10:09 am
Does anyone have a really good proper case function for peoples names? - I took a stab at one a little while ago, which is not bad, but still not perfect.
The most tricky thing seems to be a surname like:
'Pablo de Monta'
All the proper case functions, mine included, make this string:
Pablo de monta.
I've catered for names like 'van Blogs' so it doesn't make it Van blogs but I can't seem to get the 'compound' names to work.
The van side of things works using this:
IF SUBSTRING(@TempString,1,3) = 'van '
BEGIN
SET @TempString = SUBSTRING(@Tempstring,5,LEN(@TempString))
END
However, this is always at the start of the string, so it's a known position.
Things like Pablo van Tricky - the 'van' could be in any position, depending on what was in place of Pablo.
I fear I may be trying to account for too much - most proper case functions I have found do not tackle these problems, perhaps wth good reason...
February 12, 2009 at 2:08 pm
[font="Verdana"]It's a hard, hard issue. What makes it complicated are names forms like:
Xxx Vvv Yyy
Xxx vvv Yyy
Xxx VvYyy
Xxx vvYyy
Xxx V'Yyy
Xxx v'Yyy
I can remember finding valid names matching all of those forms. Oh, not to mention that many european names can contain all sorts of interesting characters.
[/font]
February 13, 2009 at 1:57 am
Yeah, it's a complete minefield - I might build an exceptions table - so if the name contains '% van %' then skip propercase, various other special characters etc
One blog on the subject basically (wisely) states that some people are pretty sensitive to how their name is written - perhaps in some circumstances just stick with what they put! - That's all great until someone registeres as Mr. A. A. !
February 13, 2009 at 7:29 am
I have said it a lot - proper-casing names is a losing proposition and I would not recommend it.
The funny thing is, I just saw a name that will mess up nearly all of your rules for proper-casing or parsing a name.
The new German minister of economic affairs, named..get this "Karl Theodor Maria Nikolaus Johann Jacob Philipp Franz Joseph Sylvester Freiherr von und zu Guttenberg"
Good luck.
February 13, 2009 at 7:44 am
lol, our firstname field's probably a varchar(50) or something, that would blow him out :p
February 13, 2009 at 7:46 am
peitech (2/13/2009)
lol, our firstname field's probably a varchar(50) or something, that would blow him out :p
As far as I can tell, his first name is Karl - so I think you are good there.
It's his middle and last names that I can't really follow.
February 13, 2009 at 7:48 am
The real issue is that names can follow multiple rules.
McDonald and Mcdonald are both correct - for different people.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply