<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniel Skinner: News and Articles on Web Development &#187; Aggeregate</title>
	<atom:link href="http://www.daniel-skinner.co.uk/tag/aggeregate/feed" rel="self" type="application/rss+xml" />
	<link>http://www.daniel-skinner.co.uk</link>
	<description>Daniel Skinner&#039;s Blog: Web Development news and articles</description>
	<lastBuildDate>Wed, 18 Mar 2009 15:11:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>String.Capitalize in C# (PHP&#8217;s ucwords in C#)</title>
		<link>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009</link>
		<comments>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009#comments</comments>
		<pubDate>Wed, 25 Feb 2009 15:10:50 +0000</pubDate>
		<dc:creator>Daniel Skinner</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Aggeregate]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Extension Method]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ucwords]]></category>

		<guid isPermaLink="false">http://www.daniel-skinner.co.uk/?p=31</guid>
		<description><![CDATA[I have been playing around with C# recently and found the need for functionality similar to that provided by PHP&#8217;s ucwords() function. I dont think this exists in C# as standard so here is a simple extension method to achieve ucwords in C# using a little bit of LINQ (the extremely useful Aggregate extension method) [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with C# recently and found the need for functionality similar to that provided by PHP&#8217;s ucwords() function. I dont think this exists in C# as standard so here is a simple extension method to achieve ucwords in C# using a little bit of LINQ (the extremely useful Aggregate extension method) to achieve it:</p>
<pre>public static string Capitalize(this String s)
{
  return s.ToCharArray().Aggregate(String.Empty,
    (working, next) =>
      working.Length == 0 &#038;&#038; next != ' ' ? next.ToString().ToUpper() : (
        working.EndsWith(" ") ? working + next.ToString().ToUpper() :
          working + next.ToString()
    )
  );
}</pre>
<p>With this included in your name space, the extension method can be used on any String instance like:</p>
<pre>string myString = "this sentence needs capitalization!";
Console.WriteLine(myString.Capitalize());
//This Sentence Needs Capitalization!</pre>
<p>Short but sweet!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daniel-skinner.co.uk/php-ucwords-in-c/25/02/2009/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
