January 8th, 2008

Generating initials from a name is trickier than you think

Even though I’m signed in, the page claims that anonymous comments are not allowed, so I’m reduced to posting my comment here and generating a trackback. Some time ago, Robert McLaws wrote a function that generates initials from a name. Let’s set aside completely the issue of non-U.S. names; the function doesn’t even handle U.S. names correctly.

Given Cal Ripken, Jr., the function comes up with the initials JCR, which is decidedly suboptimal.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.