<?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: JavaScript: String trimming and padding</title>
	<atom:link href="http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/feed/" rel="self" type="application/rss+xml" />
	<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
	<description>Courage to do something...</description>
	<lastBuildDate>Sat, 10 Jul 2010 03:56:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: fijiwebdesign</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/comment-page-1/#comment-2966</link>
		<dc:creator>fijiwebdesign</dc:creator>
		<pubDate>Mon, 08 Mar 2010 18:51:01 +0000</pubDate>
		<guid isPermaLink="false">http://sajjadhossain.com/?p=74#comment-2966</guid>
		<description>With padding strings, it would probably be better to create an array of the length of the padding, and do Array.join() with the padding as the parameter. The reason is that arrays are mutable and thus would be able to join large strings very quickly, while a loop that mutates a string on every iteration would be significantly slower. This won&#039;t be apparent for small strings, but will be significant for larger paddings.</description>
		<content:encoded><![CDATA[<p>With padding strings, it would probably be better to create an array of the length of the padding, and do Array.join() with the padding as the parameter. The reason is that arrays are mutable and thus would be able to join large strings very quickly, while a loop that mutates a string on every iteration would be significantly slower. This won&#8217;t be apparent for small strings, but will be significant for larger paddings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fijiwebdesign</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/comment-page-1/#comment-2965</link>
		<dc:creator>fijiwebdesign</dc:creator>
		<pubDate>Mon, 08 Mar 2010 18:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://sajjadhossain.com/?p=74#comment-2965</guid>
		<description>You may want to trim other characters as well:

String.prototype.trim = function(c) {
    c = (c &#124;&#124; &quot;\s&quot;);
    return this.replace(new RegExp(&quot;^[&quot;+c+&quot;]+&#124;[&quot;+c+&quot;]+$&quot;, &quot;g&quot;),&quot;&quot;);
};

Eg:

&quot; test\n&quot;.trim(&quot;\\s\\n&quot;); // trim spaces and line breaks</description>
		<content:encoded><![CDATA[<p>You may want to trim other characters as well:</p>
<p>String.prototype.trim = function(c) {<br />
    c = (c || &#8220;\s&#8221;);<br />
    return this.replace(new RegExp(&#8220;^["+c+"]+|["+c+"]+$&#8221;, &#8220;g&#8221;),&#8221;");<br />
};</p>
<p>Eg:</p>
<p>&#8221; test\n&#8221;.trim(&#8220;\\s\\n&#8221;); // trim spaces and line breaks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arafat Rahman</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/comment-page-1/#comment-407</link>
		<dc:creator>Arafat Rahman</dc:creator>
		<pubDate>Fri, 31 Oct 2008 16:27:11 +0000</pubDate>
		<guid isPermaLink="false">http://sajjadhossain.com/?p=74#comment-407</guid>
		<description>JavaScript doesn&#039;t support trim on strings. It is very easy to implement with regular expressions.
Thanks for the sharing.</description>
		<content:encoded><![CDATA[<p>JavaScript doesn&#8217;t support trim on strings. It is very easy to implement with regular expressions.<br />
Thanks for the sharing.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
