Example usage for java.io File separator

List of usage examples for java.io File separator

Introduction

In this page you can find the example usage for java.io File separator.

Prototype

String separator

To view the source code for java.io File separator.

Click Source Link

Document

The system-dependent default name-separator character, represented as a string for convenience.

Usage

From source file:Main.java

public static String combinPath(String path, String fileName) {
    return path + (path.endsWith(File.separator) ? "" : File.separator) + fileName;
}

From source file:Main.java

public static String getPathFromFilepath(String path) {
    int index = path.lastIndexOf(File.separator);
    String p = File.separator;
    if (index != -1) {
        p = path.substring(0, index);// ww  w  .ja va 2  s .c  o  m
    }
    return p;
}

From source file:Main.java

public static String getPathName(String absolutePath) {
    int start = absolutePath.lastIndexOf(File.separator) + 1;
    int end = absolutePath.length();
    return absolutePath.substring(start, end);
}

From source file:Main.java

public static String GetUpPath(String path) {
    String retPath = path.substring(0, path.lastIndexOf(File.separator));
    return retPath;

}

From source file:Main.java

public static String getNameFromFilepath(String path) {
    int index = path.lastIndexOf(File.separator);
    String name = "";
    if (index != -1) {
        name = path.substring(index + 1);
    } else {//from   ww w.j a  v a 2s  .co m
        name = path;
    }
    return name;
}

From source file:Main.java

private static boolean checkIfFileExists(String dirPath, String fileName) {
    return new File(dirPath + File.separator + fileName).exists();
}

From source file:Main.java

public static String getDirPath(String filePath) {

    return filePath.substring(0, filePath.lastIndexOf(File.separator));
}

From source file:Main.java

private static String getFileNameFromPath(String filePath) {
    int begin = filePath.lastIndexOf(File.separator);
    int end = filePath.lastIndexOf(".");
    if (end < 1) {
        return null;
    }/* w w w  .  jav  a 2s.  co  m*/
    String fileName = filePath.substring(begin + 1, end);
    return fileName;
}

From source file:Main.java

public static boolean isExistCacheInSD(String path, String cacheKey) {
    File cacheFile = new File(path + File.separator + cacheKey);
    return cacheFile.exists();
}

From source file:Main.java

public static String getDataFilesDir(Context c) {
    return c.getFilesDir().getAbsolutePath() + File.separator;
}