README.md
December 4, 2022 ยท View on GitHub
Description
How to use the String.replace function
More Info
Returns the string with the replaced characters
| Submitted On | |
| By | SkunkPussie |
| Level | Intermediate |
| User Rating | 3.8 (19 globes from 5 users) |
| Compatibility | |
| Category | String Manipulation |
| World | Java |
| Archive File |
Source Code
// look for the word 'four' and replace with 'five' for all(g option) occurences
// String.replace(/text to find/options,replacement text)
sTMP = "see my four assed monkey, see my four assed monkey"
sTMP = sTMP.replace(/four/g,"five")
// outputted text looks like this
// sTMP = "see my five assed monkey, see my five assed monkey"
// without the (g) option it would look like this
sTMP = "see my four assed monkey, see my four assed monkey"
sTMP = sTMP.replace(/four/g,"five")
// outputted text looks like this
// sTMP = "see my five assed monkey, see my four assed monkey"