Fall 2024 - P1
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.4 String Operations
3.4 Team Teach String Operations
Replacing Substrings
- Can replace different parts of a string with something else
- .replace() in Python and JS
print("Hello Brawler".replace("Brawler", "Mihir"))
Hello Mihir
%%js
console.log("Hello Brawler".replace("Brawler", "Mihir"));
<IPython.core.display.Javascript object>
- Use Case: Useful for replacing specific parts of text without having to re initiate the whole thing again