Created
December 23, 2014 16:02
-
-
Save alexdumont/8cc96dcdf43fed80a897 to your computer and use it in GitHub Desktop.
str_replace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Remplace(a,b, expr) { | |
| var i=0 | |
| while (i!=-1) { | |
| i=expr.indexOf(a,i); | |
| if (i>=0) { | |
| expr=expr.substring(0,i)+b+expr.substring(i+a.length); | |
| i+=b.length; | |
| } | |
| } | |
| return expr | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment