Last active
September 1, 2019 04:36
-
-
Save heinthanth/7d814a855e4d1a9dfc9a35fbc520311a to your computer and use it in GitHub Desktop.
string 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
var str = "Hello, John Doe!"; | |
var result = str.replace("John Doe", "Hein Thanth"); | |
// now result is "Hello, Hein Thanth!"; | |
var str = "Kali Linux is for Hackers. Also, Kali Linux, which is Debian based. Black Arch Linux too!"; | |
var result = str.replace("Kali Linux", "Parrot Sec OS"); | |
// now result is "Parrot Sec OS is for Hackers. Also, Kali Linux, which is Debian based. Black Arch Linux too!" | |
// although the word "Kali Linux" contain twice. Only Replace first Match |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment