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

[ad_1]


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.

[ad_2]

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