1. 程式人生 > >substring從指定字串開始擷取

substring從指定字串開始擷取

String filename=F:\workspace\ssh_photo\WebContent\uploadFile\1444783552338pic.jpg ;
int begin=useName.indexOf(“ssh_photo”);
int last=useName.length();
System.out.println(useName.substring(begin,last)); 

想要擷取指定字串及其之後的字串:ssh_photo及其之後的字串。

最後輸出得到:ssh_photo\WebContent\uploadFile\1444783552338pic.jpg