<?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&#038;utm_medium=feed&#038;utm_campaign=feed</link>
	<description>Courage to do something...</description>
	<lastBuildDate>Tue, 17 Jan 2012 11:10:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jesse Bethke</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/comment-page-1/#comment-4253</link>
		<dc:creator>Jesse Bethke</dc:creator>
		<pubDate>Mon, 09 May 2011 16:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://sajjadhossain.com/?p=74#comment-4253</guid>
		<description>I love that you solve this by prototyping the String object. Very elegant solution.</description>
		<content:encoded><![CDATA[<p>I love that you solve this by prototyping the String object. Very elegant solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clarence Fredericks</title>
		<link>http://sajjadhossain.com/2008/10/31/javascript-string-trimming-and-padding/comment-page-1/#comment-3821</link>
		<dc:creator>Clarence Fredericks</dc:creator>
		<pubDate>Mon, 07 Feb 2011 16:56:41 +0000</pubDate>
		<guid isPermaLink="false">http://sajjadhossain.com/?p=74#comment-3821</guid>
		<description>I just came across a nice, customizable JavaScript library called jPaq which allows you to download just these functions into a minified JS file.  Here is the link to the download page:  http://jpaq.org/download/1.0.0.00003</description>
		<content:encoded><![CDATA[<p>I just came across a nice, customizable JavaScript library called jPaq which allows you to download just these functions into a minified JS file.  Here is the link to the download page:  <a href="http://jpaq.org/download/1.0.0.00003" rel="nofollow">http://jpaq.org/download/1.0.0.00003</a></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-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>

