qwerty
Member since Jul 17, 2011
- Profile: /members/8639-qwerty.htm
- Comments: 3
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 »