Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String parseJarfileName(String jarLocation) {
- if(jarLocation == null)
- return ""; // path to jar location is empty,
- // return so stuff doesn't get messed up
- String jarfileName = ""; // name of the .jar server executable
- for(int i = jarLocation.length(); jarLocation.charAt(i - 1) != '/'; i --) {
- // read the string backwards until a / is found,
- // signaling that the jarfile name has ended
- // as this is done, concatenate the characters of the jarfile name
- jarfileName += jarLocation.charAt(i - 1);
- jarfileName.trim();
- // the jarfile name will be backwards here, so reverse it
- String str = new StringBuilder(jarfileName).reverse().toString();
- jarfileName = str;
- }
- return jarfileName;
- }
- // written by 2xedo: twitter.com/2xedo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement