Java Utililty Methods File Name Extract

List of utility methods to do File Name Extract

Description

The list of methods to do File Name Extract are organized into topic(s).

Method

StringextractFilenameFromURL(String url)
extract Filename From URL
if (url.contains("/")) {
    return url.substring(url.lastIndexOf('/') + 1, url.length());
return url;
StringextractFileNameFromUrl(String url)
extract File Name From Url
String newFileName = "";
String tempStr = "";
int counter = url.length() - 1;
char ch = url.charAt(counter);
while (ch != '/') {
    tempStr += ch;
    ch = url.charAt(counter);
    counter--;
...
StringextractFilenameFromUrlPath(String urlPath)
Extract the URL filename from the given request URL path.
String filename = extractFullFilenameFromUrlPath(urlPath);
int dotIndex = filename.lastIndexOf('.');
if (dotIndex != -1) {
    filename = filename.substring(0, dotIndex);
return filename;
String[]extractFileNames(String[] fileNames)
extract File Names
String[] newFileNames = new String[fileNames.length];
for (int i = 0; i < fileNames.length; i++) {
    newFileNames[i] = extractFileName(fileNames[i]);
return newFileNames;