java – How can I remove a substring from a given String?
java – How can I remove a substring from a given String?
You could easily use String.replace()
:
String helloWorld = Hello World!;
String hellWrld = helloWorld.replace(o,);
You can use StringBuffer
StringBuffer text = new StringBuffer(Hello World);
text.replace( StartIndex ,EndIndex ,String);
java – How can I remove a substring from a given String?
replace(regex, replacement);
replaceAll(regex, replacement);
In your example,
String hi = Hello World!
String no_o = hi.replaceAll(o, );