Skip to main content

qwerty

Member since Jul 17, 2011

Recent Blog Comments By qwerty

  • Ask Ben: Javascript String Replace Method

    Posted on Jul 26, 2011 at 3:52 PM

    Here is what I'm getting from the following code: var str=" Hai'Hello"; document.write(str.replaceAll("'","\\\\'")); alert(str.replaceAll("'","\\\\'")); Output: Hai\\'Hello This is correct. The point of this function is to perform a repla... read more »

  • Ask Ben: Javascript String Replace Method

    Posted on Jul 17, 2011 at 1:01 PM

    tomy, if you want to replace a specific instance (2) in a string. Use this replaceAll function: http://www.dumpsite.com/replaceAll.php and then pass it a anonymous function for "str2" with the following wrapper function: function replaceInstance(str, str1, str2, instance, ignore) { ... read more »

  • Ask Ben: Javascript String Replace Method

    Posted on Jul 17, 2011 at 12:20 PM

    Try this replaceAll: http://www.dumpsite.com/replaceAll.php It is very fast, and it will work for ALL these conditions that many others fail on: "x".replaceAll("x", "xyz"); xyz "x".replaceAll("", "xyz"); xyzxxyz "aA".replace... read more »

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel