Answers for "when i do replace in java why does it cut off the string"

0

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));
Posted by: Guest on June-24-2020
0

how to cut a certion part from a string in java

str2=str.substring(begin, [end])
Posted by: Guest on June-24-2020

Code answers related to "when i do replace in java why does it cut off the string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language