when i do replace in java why does it cut off the string code example
Example 1: how to cut a certion part from a string in java
int startIndex = str.indexOf("(");
int endIndex = str.indexOf(")");
String replacement = "I AM JUST A REPLACEMENT";
String toBeReplaced = str.substring(startIndex + 1, endIndex);
System.out.println(str.replace(toBeReplaced, replacement));
Example 2: how to cut a certion part from a string in java
str2=str.substring(begin, [end])