<?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>Webdevotion.be &#187; snippet</title>
	<atom:link href="http://www.webdevotion.be/blog/tag/snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdevotion.be/blog</link>
	<description>Trainer for the Flash Platform and iOS</description>
	<lastBuildDate>Tue, 01 Nov 2011 10:14:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Snippet day: last comma becomes &#8220;and&#8221;</title>
		<link>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/</link>
		<comments>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 08:25:40 +0000</pubDate>
		<dc:creator>Webdevotion</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[Air]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://webdevotion.be/blog/?p=243</guid>
		<description><![CDATA[This little snippet will replace the last comma in a string by the word &#8221; and &#8220;. Making it more readable for the end user. In other words: the string &#8220;Other examples are rats, mice,other rodents&#8221; will be converted into &#8230; <a href="http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This little snippet will replace the last comma in a string by the word &#8221; and &#8220;.  Making it more readable for the end user. </p>
<p>In other words: the string &#8220;Other examples are rats, mice,other rodents&#8221; will be converted into &#8220;Other examples are rats, mice and other rodents&#8221;.<br />
<span id="more-243"></span><br />
<code><br />
var a : Array = ["rats","mice","other rodents"];<br />
var s : String = a.toString(); // returns rats,mice,other rodents<br />
var r : RegExp = /,(?![^,]+,)/g; // the magical formula<br />
s = s.replace( r ," and "); // replace the last , with and<br />
trace( s ); // rats, mice and rodents<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdevotion.be/blog/2009/04/09/snippet-day-last-comma-becomes-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

