README.md
December 4, 2022 ยท View on GitHub
Description
To replace a word or characters in a string, using JavaScript.
More Info
| Submitted On | |
| By | w0rm |
| Level | Beginner |
| User Rating | 4.0 (8 globes from 2 users) |
| Compatibility | |
| Category | String Manipulation |
| World | Java |
| Archive File |
Source Code
function stringreplace(str,srchfor,rplwith){
while (str.indexOf(srchfor)>-1) {
pos= str.indexOf(srchfor);
str = "" + (str.substring(0, pos) + rplwith + str.substring((pos + srchfor.length), str.length));
}
return str;
}