<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ucwords() to convert a string to title case in PHP</title>
	<atom:link href="http://style-vs-substance.com/programming/ucwords-to-convert-a-string-to-title-case-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://style-vs-substance.com/programming/ucwords-to-convert-a-string-to-title-case-in-php/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 23 Jun 2010 17:37:21 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jim Mayes</title>
		<link>http://style-vs-substance.com/programming/ucwords-to-convert-a-string-to-title-case-in-php/comment-page-1/#comment-663</link>
		<dc:creator>Jim Mayes</dc:creator>
		<pubDate>Thu, 25 Dec 2008 06:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://style-vs-substance.com/ucwords-to-convert-a-string-to-title-case-in-php/2008/03/#comment-663</guid>
		<description>And of course, none of these solutions address the fact that stylistically speaking, it may not be appropriate to capitalize certain words in a title (prepositions, conjunctions, articles). For example the &#039;is&#039; and &#039;a&#039; in the above code.</description>
		<content:encoded><![CDATA[<p>And of course, none of these solutions address the fact that stylistically speaking, it may not be appropriate to capitalize certain words in a title (prepositions, conjunctions, articles). For example the &#8216;is&#8217; and &#8216;a&#8217; in the above code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Mayes</title>
		<link>http://style-vs-substance.com/programming/ucwords-to-convert-a-string-to-title-case-in-php/comment-page-1/#comment-662</link>
		<dc:creator>Jim Mayes</dc:creator>
		<pubDate>Thu, 25 Dec 2008 06:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://style-vs-substance.com/ucwords-to-convert-a-string-to-title-case-in-php/2008/03/#comment-662</guid>
		<description>Thanks for pointing that out Jim! I hadn&#039;t considered the need to address other characters like parentheses, slashes etc and how they affect capitalization within a string, which really reinforces just how slick of a function you have there. As you mention, even the combination of ucwords() with strlower() would fail to catch those instances. Reconsidering the nature of the problem, mb_convert_case() may be worth a look.

&lt;pre class=&quot;brush:php&quot;&gt;
$str = &#039;This is a Title (WITH PARENTHESES!)&#039;;
echo titleCase($str);
echo mb_convert_case($str, MB_CASE_TITLE);
&lt;/pre&gt;

Of course I haven&#039;t done extensive testing of the two head to head (just the test above), and I should have done more testing before I pulled the trigger and wrote the original post suggesting ucwords(). And that&#039;s also with the caveat that you will need multibyte string support compiled into PHP to have the mb_convert_case() function available.</description>
		<content:encoded><![CDATA[<p>Thanks for pointing that out Jim! I hadn&#8217;t considered the need to address other characters like parentheses, slashes etc and how they affect capitalization within a string, which really reinforces just how slick of a function you have there. As you mention, even the combination of ucwords() with strlower() would fail to catch those instances. Reconsidering the nature of the problem, mb_convert_case() may be worth a look.</p>
<pre class="brush:php">
$str = 'This is a Title (WITH PARENTHESES!)';
echo titleCase($str);
echo mb_convert_case($str, MB_CASE_TITLE);
</pre>
<p>Of course I haven&#8217;t done extensive testing of the two head to head (just the test above), and I should have done more testing before I pulled the trigger and wrote the original post suggesting ucwords(). And that&#8217;s also with the caveat that you will need multibyte string support compiled into PHP to have the mb_convert_case() function available.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JimG</title>
		<link>http://style-vs-substance.com/programming/ucwords-to-convert-a-string-to-title-case-in-php/comment-page-1/#comment-661</link>
		<dc:creator>JimG</dc:creator>
		<pubDate>Thu, 25 Dec 2008 04:29:33 +0000</pubDate>
		<guid isPermaLink="false">http://style-vs-substance.com/ucwords-to-convert-a-string-to-title-case-in-php/2008/03/#comment-661</guid>
		<description>Where the above complex script excels is in cleaning up messy user inputâ€”particularly in fixing titles set in all caps. The ucwords function will not alter characters already set in uppercase whereas the one above will. While you could initially overcome this by applying strtolower($string) then ucwords($string), you run into problems with words immediately following certain punctuation (such as slashes, brackets, parens, etc.). That said, there may be instances where simple strings will be perfectly served by ucwords.</description>
		<content:encoded><![CDATA[<p>Where the above complex script excels is in cleaning up messy user inputâ€”particularly in fixing titles set in all caps. The ucwords function will not alter characters already set in uppercase whereas the one above will. While you could initially overcome this by applying strtolower($string) then ucwords($string), you run into problems with words immediately following certain punctuation (such as slashes, brackets, parens, etc.). That said, there may be instances where simple strings will be perfectly served by ucwords.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
