[Solved] Working with strings in java : extract a particular string [closed]



First make ‘path’ a StringBuffer to make it easier to work with. Then use indexes:

StringBuffer path = new StringBuffer("cmd /c start D:\\SMPPPushGW_SMSCID1_Passive\\note.bat");
String result = path.substring(path.indexOf("start")+5, path.lastIndexOf("\\"));

As mentioned, File API may be useful, but also URI.

solved Working with strings in java : extract a particular string [closed]