How can I refactor substring concatenations to StringBuilder?
String line = "this is my start and my end string";
int start = line.indexOf("start");
line = line.substring(0, start) + line.substring(start + 5);
int end = line.indexOf("end");
line = line.substring(0, end) + line.substring(end + 3);
//result: this is my and my string";
How would the same code look like with StringBuilder? When I want to execute substrings several times one after the other?