String xStr = "hello/master/yoda";
String remv_last = xStr.substring(0, xStr.lastIndexOf("/"))
System.out.println(remv_last);
output
hello/master
My question is; how can I get this output, thanks for helping.
master/yoda
use indexOf
String xStr = "hello/master/yoda";
String remv_last = xStr.substring(xStr.indexOf("/") + 1);
System.out.println(remv_last);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With