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));str2=str.substring(begin, [end]) String str = "manchester united (with nice players)";
System.out.println(str.replace("(with nice players)", ""));
int index = str.indexOf("(");
System.out.println(str.substring(0, index));
Also in Java:
- java script print date in YYYY-MM-DD format
- récupérer les données d un liste java
- how to print to console in java
- sublist in java
- how to set a windows background image tkinter
- substring java
- how to initialize an array in java
- alfred workflow
- how to separate no and text in java
- read lines of file randomly java
- java integer to binary string
- java check if args is empty
- java hashmap get value
- java create clas
- thread sleep java
- java random between two strings
- android elevation not working
- remove item from arraylist in java
- java for
- how to get multiple integer input in java
- how to print in java
- taking date as input in java
- processing sound android
- rock paper scissors java