1int startIndex = str.indexOf("(");
2int endIndex = str.indexOf(")");
3String replacement = "I AM JUST A REPLACEMENT";
4String toBeReplaced = str.substring(startIndex + 1, endIndex);
5System.out.println(str.replace(toBeReplaced, replacement));
1String str = "manchester united (with nice players)";
2System.out.println(str.replace("(with nice players)", ""));
3int index = str.indexOf("(");
4System.out.println(str.substring(0, index));