I need to remove last text after :
in my String and :
too. I have tried this. Please review. If there is a better way to do, please tell me.
String test = "temp:content:region:deposit:up";
System.out.println(test.replace(test.substring(test.lastIndexOf(":"), test.length()), ""));