Java Path Convert To pathTo(String filename)

Here you can find the source of pathTo(String filename)

Description

path To

License

Open Source License

Declaration

public static String pathTo(String filename) 

Method Source Code

//package com.java2s;

public class Main {
    public static String pathTo(String filename) {
        String result = "";
        int p = filename.lastIndexOf('/');
        if (p >= 0) {
            result = filename.substring(0, p);
        }/*from   w  w  w  .ja  v  a  2s . co  m*/
        return result;
    }

    public static String substring(StringBuffer buf, int start, int lim) {
        int len = lim - start;
        char[] result = new char[len];
        buf.getChars(start, lim, result, 0);
        return String.valueOf(result);
    }
}

Related

  1. filePathToClassNameOrNull(String filePathWithExtension)
  2. filePathToClassPath(String path)
  3. filePathToJavaBinaryName(final String filePath, final String separator)
  4. filePathToPackagePathOrNull(String path)
  5. filePathToUrl(String filePath)
  6. pathTo(String ref)
  7. pathToAdjacencyList(final int[] path, final int[] adjacencyList)
  8. pathToClassName(String path)
  9. pathToClassName(String pathName)