PHP 4.0 Bug #8328 Updated: ucwords and ucfirst misbehaving with quotes

From: Date: Wed, 10 Jan 2001 06:37:44 +0000
Subject: PHP 4.0 Bug #8328 Updated: ucwords and ucfirst misbehaving with quotes
Groups: php.dev 
Request: Send a blank email to php-dev+get-43635@lists.php.net to get a copy of this message
ID: 8328 Updated by: david Reported By: vitaliyf@gameaholic.com Status: Open Old-Bug Type: Strings related Bug Type: Feature/Change Request Assigned To: Comments: i disagree with the proposed change to ucfirst (which incidentally returns >>"test2" again<<) since, unlike ucwords, it isn't necessarily only used for natural language. Previous Comments: --------------------------------------------------------------------------- [2000-12-20 01:03:00] vitaliyf@gameaholic.com Another unrelated ucwords/ucfirst bug(?): <?php $string = 'this is a "test" with word "test" in quotes'; print ucwords($string); $string = '"test2" again'; print ucfirst($string); ?> produces: This Is A "test" With Word "test" In Quotes "test2" Again I understand that by algorithm, first character of each word *IS* upper-cased (because first character is "). However, for us humans, " is not considered a part of a word, therefore "t" in above example should be treated as first letter, and test and test2 should be Test and Test2. I think that any non-alphanumeric character that is in the beginning of a word (meaning follows a whitespace) should not be considered as "first". So then: "test1" - 'test2' would be "Test1" - 'Test2' "test3" -'test4' would be "Test3" -'Test4' "test5-test6" would be "Test5-test6" Comments welcome.. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8328

« previous php.dev (#43635) next »