What function can replace a string with another string?
Example #1: What will replace "HelloBrother" with "Brother"?
"HelloBrother"
"Brother"
Example #2: What will replace "JAVAISBEST" with "BEST"?
"JAVAISBEST"
"BEST"
The replace method is what you're looking for.
replace
For example:
String replacedString = someString.replace("HelloBrother", "Brother");
1.4m articles
1.4m replys
5 comments
57.0k users