/ Published in: JavaScript
I'll never learn how to use this Markdown system. Anyway, here is the fixed code based on my comment on the following page:
http://snipplr.com/view/14206/replace-spaces-with-underscores/
I'm sorry, I don't mean to hijack the code. :(
http://snipplr.com/view/14206/replace-spaces-with-underscores/
I'm sorry, I don't mean to hijack the code. :(
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var str = "This string has too many spaces."; var result = str.replace(/(\s| |&\#160;)+/gi, "_"); document.write(result);