Revision: 13087
Updated Code
at April 8, 2009 05:17 by walokra
Updated Code
/**
* Trim the file path from the given file name. Anything before the last occurred "/" and "\" will be
* trimmed, including the slash.
*
* @param fileName
* The file name to trim the file path from.
* @return The file name with the file path trimmed.
*/
public static String trimFilePath(String fileName) {
return fileName.substring(fileName.lastIndexOf("/") + 1).substring(fileName.lastIndexOf("\\") + 1);
}
Revision: 13086
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 8, 2009 05:17 by walokra
Initial Code
/**
* Trim the eventual file path from the given file name. Anything before the last occurred "/" and "\" will be
* trimmed, including the slash.
*
* @param fileName
* The file name to trim the file path from.
* @return The file name with the file path trimmed.
*/
public static String trimFilePath(String fileName) {
return fileName.substring(fileName.lastIndexOf("/") + 1).substring(fileName.lastIndexOf("\\") + 1);
}
Initial URL
Initial Description
Initial Title
Trim the file path from the given file name.
Initial Tags
java, files
Initial Language
Java