Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static final String KML_FILE_ENDS = ".kml"; public static String getKmlSimpleFileName(File file) { String fileName = file.getName(); if (fileName.endsWith(KML_FILE_ENDS)) { return fileName.substring(0, fileName.length() - KML_FILE_ENDS.length()); } else { return fileName; } } }