Javascript Replace function
How to use the String.replace function
AI
Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Zdrojový kód
// 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"
Původní komentáře (3)
Obnoveno z Wayback Machine