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
3 Respostas
+ 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
+ 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
0
I want to run execution