Javascript replace a character with a space
<p>I need to get the name of the page from a url. I did this way:</p>

<pre><code>var filename = window.location.href.substr(window.location.href.lastIndexOf('/')+1)
// -&gt; 'state.aspx' 

var statelookup = filename.substr(0, filename.lastIndexOf('.'))
// -&gt; 'state'
</code></pre>

<p>Now for e.g, my statelookup has a value like New-York or North-Carolina, how do I replace hyphen with a space in between?</p>
