Here you can find the source of getFileName(String originPath)
Parameter | Description |
---|---|
originPath | The complete path. |
public static String getFileName(String originPath)
//package com.java2s; import java.io.File; public class Main { /**//w ww . ja va 2 s . co m * Get the file name, given a complete path. * @param originPath The complete path. * @return */ public static String getFileName(String originPath) { String file = ""; try { file = originPath.substring(originPath.lastIndexOf(File.separatorChar) + 1); } catch (Exception e) { e.printStackTrace(); } return file; } }