Java tutorial
//package com.java2s; public class Main { public static String getExternalPackageId(String extPkgHref) { // System.out.println("EPID1="+extPkgHref); int indBSL = extPkgHref.lastIndexOf("\\"); int indSL = extPkgHref.lastIndexOf("/"); int indDotXPDL = extPkgHref.lastIndexOf(".xpdl"); if (indSL != -1 || indBSL != -1) { int ind = indSL; if (indBSL > indSL) { ind = indBSL; } extPkgHref = extPkgHref.substring(indSL + 1); } if (indDotXPDL != -1) { extPkgHref = extPkgHref.substring(0, extPkgHref.length() - 5); } // System.out.println("EPID2="+extPkgHref); return extPkgHref; } }