How to find the sub string at run time, means a sub string will replace with another string in a given string at run time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find the sub string at run time, means a sub string will replace with another string in a given string at run time

Need methods, logic

20th Oct 2019, 3:54 AM
Rodda Sri Ranga Sudha
Rodda Sri Ranga Sudha - avatar
3 Answers
+ 5
Java has a String.replace() method. String str = "This are some text"; System.out.print(str.replace("text", "cookies")); For its internal implementation, take a look at the code in this link. https://www.javatpoint.com/java-string-replace
20th Oct 2019, 3:58 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Like, Enter the string.. Hi hello how are you Enter sub string.. hello Enter the new substring Hi New string is ..Hi hi how are you
20th Oct 2019, 4:25 AM
Rodda Sri Ranga Sudha
Rodda Sri Ranga Sudha - avatar
0
I want to run execution
20th Oct 2019, 4:02 AM
Rodda Sri Ranga Sudha
Rodda Sri Ranga Sudha - avatar