The replace() method of the String class replaces a given character in a given string with a new character. The general syntax for this method is as follows:
For example, Sting s=”Hello”;
Now the following syntax will replace all the l’s in this string with m’s:
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.