Belgi Belgi - 3 months ago 9
Java Question

How can I remove a substring from a given String?

Is there an easy way to remove substring from a given String in Java ?

example : "Hello World!" , removing "o" - > "Hell Wrld!"

Answer

You could easily use String.replace():

String helloWorld = "Hello World!";
String hellWrld = helloWorld.replace("o","");