Java File Name Create fileName(String contentFile)

Here you can find the source of fileName(String contentFile)

Description

file Name

License

Open Source License

Declaration

static String fileName(String contentFile) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static String fileName(String contentFile) {
        if (contentFile == null || contentFile.isEmpty()) {
            return "";
        }/*from ww  w  .j a v a 2s.  co  m*/
        int i1 = contentFile.lastIndexOf("/");
        int i2 = contentFile.lastIndexOf("\\");
        if (i1 > 0 || i2 > 0) {
            return contentFile.substring(Math.max(i1, i2) + 1);
        }
        return contentFile;
    }
}

Related

  1. addTimestampToFilename(Date date, String fileName)
  2. addTimestampToFilename(String fileName)
  3. addTimeStampToFileName(String name)
  4. fileName(Class clazz)
  5. filename(final String path)
  6. fileName(String file)
  7. fileName(String file, String moduleName)
  8. filename(String filename)
  9. fileName(String filename)