NYCPHP Meetup

NYPHP.org

[nycphp-talk] ucfirst question

David Krings ramons at gmx.net
Tue Jun 12 19:59:55 EDT 2007


Hi!

Being a ucfirst issue, I want to capitalize the first letter in a 
string. What caught my attention is this sentence in the PHP 
documentation: "Note that 'alphabetic' is determined by the current 
locale. For instance, in the default "C" locale characters such as 
umlaut-a (ä) will not be converted."

Well, that is what potentially might happen. Is there a less language 
discriminatory version of ucfirst or do I need to snip off the first 
character and check it against ä,ö, and ü to make them Ä, Ö, and Ü? That 
will take care of German, but what about other languages?

The locale of my system is US-English, but the script could run on other 
locales as well. Is there any way to switch the locale on the fly? Even 
if, I'd neet to noodle the string through ucfirst through all quite a 
bunch of locales.

This is "bupid" how my 2 year old would put it.

David



More information about the talk mailing list