static String getOutputName(String resource)
    {
        final int secondToTheLastDot = resource.lastIndexOf('.', resource.length()-5), 
                slash = resource.lastIndexOf('/', secondToTheLastDot);
        
        return resource.substring(slash+1, secondToTheLastDot);
    }
static String getOutputName ( String resource ) { final int secondToTheLastDot = resource . lastIndexOf ( '.' , resource . length ( ) - 5 ) , slash = resource . lastIndexOf ( '/' , secondToTheLastDot ) ; return resource . substring ( slash + 1 , secondToTheLastDot ) ; }
Returns "foo" from "path/to/foo.java.stg".