1//To delete starting from "opened"
2String str ="13 opened by someone";
3
4String result = str.substring(0,str.lastIndexOf(" opened"));
1// Works only if you have a certain character at which you want to cut
2String text = "Image.png";
3
4String[] cutText = text.split("\\.");
5
6// cutText[0] has value "Image"
7// cutText[1] has value "png"