<?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>Thomas Hambach - Web engineer &#187; javascript</title>
	<atom:link href="http://www.rdlt.com/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rdlt.com</link>
	<description>Web development, Web design &#38; Usability</description>
	<lastBuildDate>Mon, 06 Dec 2010 09:45:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>javascript str_replace equivalent</title>
		<link>http://www.rdlt.com/javascript-str_replace-equivalent.html</link>
		<comments>http://www.rdlt.com/javascript-str_replace-equivalent.html#comments</comments>
		<pubDate>Fri, 31 Aug 2007 21:47:43 +0000</pubDate>
		<dc:creator>Thomas Hambach</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://blog.rdlt.com/?p=4</guid>
		<description><![CDATA[I needed the equivalent of str_replace in JavaScript and was able to fish up this nifty piece of code! Enjoy. /** * str_replace * * This function returns a string or an array with all occurrences of * [search] in [subject] replaced with the given [replace] value. * If you don't need fancy replacing rules [...]]]></description>
			<content:encoded><![CDATA[<p>I needed the equivalent of str_replace in JavaScript and was able to fish up this nifty piece of code! Enjoy.</p>
<pre><code class="html">/**
* str_replace
*
* This function returns a string or an array with all occurrences of
* [search] in [subject] replaced with the given [replace] value.
* If you don't need fancy replacing rules (like regular expressions), you should always use this function.
*
* @param	string	search
* @param	string	replace
* @param	string	string
*/
function str_replace (search, replace, subject)
{
var result = "";
var  oldi = 0;
for (i = subject.indexOf (search); i &gt; -1; i = subject.indexOf (search, i))
{
result += subject.substring (oldi, i);
result += replace;
i += search.length;
oldi = i;
}
return result + subject.substring (oldi, subject.length);
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rdlt.com/javascript-str_replace-equivalent.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

