<?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: &#8220;string&#8221;.supplant() a jewel from Douglas Crockford</title>
	<atom:link href="http://www.justise.com/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justise.com/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/</link>
	<description>Programming - Development</description>
	<lastBuildDate>Tue, 27 Jul 2010 05:58:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ruben</title>
		<link>http://www.justise.com/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/comment-page-1/#comment-4705</link>
		<dc:creator>Ruben</dc:creator>
		<pubDate>Mon, 20 Apr 2009 01:51:32 +0000</pubDate>
		<guid isPermaLink="false">http://blackbeltcoder.net/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/#comment-4705</guid>
		<description>Douglas Crockford&#039;s jewel handles just one level object hierarchy.
Following small modification handles any  object.
Placeholders now can include dotted notation - {foo.boo.moo.uff....}.
I call it present() - because it looks ideal for presenting preformatted object&#039;s values 
        String.prototype.present = function(o)
                                    { return this.replace(/{([^{}]*)}/g,
                                                          function(a, b)
                                                            {
                                                                var p = b.split(&#039;.&#039;);
                                                                var r = o;
                                                                try
                                                                {
                                                                for(s in pat) {r = r[p[s]]};
                                                                }
                                                                catch(e){ r = a;} 
                                                                return typeof r === &#039;string&#039; &#124;&#124; typeof r === &#039;number&#039; ? r : a;
                                                            }
                                                          );
                                    };</description>
		<content:encoded><![CDATA[<p>Douglas Crockford&#8217;s jewel handles just one level object hierarchy.<br />
Following small modification handles any  object.<br />
Placeholders now can include dotted notation &#8211; {foo.boo.moo.uff&#8230;.}.<br />
I call it present() &#8211; because it looks ideal for presenting preformatted object&#8217;s values<br />
        String.prototype.present = function(o)<br />
                                    { return this.replace(/{([^{}]*)}/g,<br />
                                                          function(a, b)<br />
                                                            {<br />
                                                                var p = b.split(&#8216;.&#8217;);<br />
                                                                var r = o;<br />
                                                                try<br />
                                                                {<br />
                                                                for(s in pat) {r = r[p[s]]};<br />
                                                                }<br />
                                                                catch(e){ r = a;}<br />
                                                                return typeof r === &#8217;string&#8217; || typeof r === &#8216;number&#8217; ? r : a;<br />
                                                            }<br />
                                                          );<br />
                                    };</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris &#8220;Justise&#8221; Gray &#187; Format strings with Mootools</title>
		<link>http://www.justise.com/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/comment-page-1/#comment-3829</link>
		<dc:creator>Kris &#8220;Justise&#8221; Gray &#187; Format strings with Mootools</dc:creator>
		<pubDate>Thu, 29 Jan 2009 22:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://blackbeltcoder.net/2007/12/28/stringsupplant-a-jewel-from-douglas-crockford/#comment-3829</guid>
		<description>[...] Remember String.Supplant()? [...]</description>
		<content:encoded><![CDATA[<p>[...] Remember String.Supplant()? [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
