<?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: Faster JavaScript Trim</title>
	<atom:link href="http://blog.stevenlevithan.com/archives/faster-trim-javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript</link>
	<description>A JavaScript and regular expression centric blog</description>
	<lastBuildDate>Sat, 13 Mar 2010 15:18:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Erik Landvall</title>
		<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript/comment-page-3#comment-48894</link>
		<dc:creator>Erik Landvall</dc:creator>
		<pubDate>Tue, 09 Mar 2010 12:48:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/javascript/faster-trim/#comment-48894</guid>
		<description>I rewrote trim12 somewhat...
I don&#039;t know if it&#039;s as fast as the original, but can&#039;t see why it would&#039;nt be.


String.prototype.trim = function(){
&#160;&#160;&#160;&#160;return this.triml().trimr();
};

String.prototype.triml = function(){
&#160;&#160;&#160;&#160;return this.replace(/^\s\s*/, &#039;&#039;);
};

String.prototype.trimr = function(){
&#160;&#160;&#160;&#160;var ws  = /\s/,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;i   = this.length;
&#160;&#160;&#160;&#160;while(ws.test(this.charAt(--i)));
&#160;&#160;&#160;&#160;return this.slice(0, i + 1);
};</description>
		<content:encoded><![CDATA[<p>I rewrote trim12 somewhat&#8230;<br />
I don&#8217;t know if it&#8217;s as fast as the original, but can&#8217;t see why it would&#8217;nt be.</p>
<p>String.prototype.trim = function(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;return this.triml().trimr();<br />
};</p>
<p>String.prototype.triml = function(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;return this.replace(/^\s\s*/, &#8221;);<br />
};</p>
<p>String.prototype.trimr = function(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;var ws  = /\s/,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i   = this.length;<br />
&nbsp;&nbsp;&nbsp;&nbsp;while(ws.test(this.charAt(&#8211;i)));<br />
&nbsp;&nbsp;&nbsp;&nbsp;return this.slice(0, i + 1);<br />
};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript/comment-page-3#comment-45642</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 03 Jan 2010 08:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/javascript/faster-trim/#comment-45642</guid>
		<description>I read this article some years ago and found it very useful, I will use trim12 because of shorter code and still good performance, thanks.</description>
		<content:encoded><![CDATA[<p>I read this article some years ago and found it very useful, I will use trim12 because of shorter code and still good performance, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elixir &#187; Blog Archive &#187; Javascript Trim</title>
		<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript/comment-page-3#comment-45298</link>
		<dc:creator>Elixir &#187; Blog Archive &#187; Javascript Trim</dc:creator>
		<pubDate>Thu, 24 Dec 2009 12:05:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/javascript/faster-trim/#comment-45298</guid>
		<description>[...] Credit. I made it available to the String prototype.     Read [...]</description>
		<content:encoded><![CDATA[<p>[...] Credit. I made it available to the String prototype.     Read [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RobG</title>
		<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript/comment-page-3#comment-44995</link>
		<dc:creator>RobG</dc:creator>
		<pubDate>Thu, 17 Dec 2009 01:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/javascript/faster-trim/#comment-44995</guid>
		<description>Seems this won&#039;t be needed in the future as ECMAScript Ed. 5 includes String.prototype.trim. And of course all browser vendors will rush to implement it immediately. :-)

Otherwise, an interesting post. It may appear to be premature optimisation, however it shows that while some algorithms are very fast in some browsers, they may also be very slow in others. It&#039;s good to use an algorithm that is reasonably fast in a representative cross-seciton.</description>
		<content:encoded><![CDATA[<p>Seems this won&#8217;t be needed in the future as ECMAScript Ed. 5 includes String.prototype.trim. And of course all browser vendors will rush to implement it immediately. <img src='http://blog.stevenlevithan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Otherwise, an interesting post. It may appear to be premature optimisation, however it shows that while some algorithms are very fast in some browsers, they may also be very slow in others. It&#8217;s good to use an algorithm that is reasonably fast in a representative cross-seciton.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Garrett</title>
		<link>http://blog.stevenlevithan.com/archives/faster-trim-javascript/comment-page-3#comment-44047</link>
		<dc:creator>Andrew Garrett</dc:creator>
		<pubDate>Thu, 26 Nov 2009 11:55:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.stevenlevithan.com/javascript/faster-trim/#comment-44047</guid>
		<description>This looks suspiciously like premature optimisation, I&#039;m not sure how many cases there are where trim() is really performance-critical.</description>
		<content:encoded><![CDATA[<p>This looks suspiciously like premature optimisation, I&#8217;m not sure how many cases there are where trim() is really performance-critical.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
