I have a file name reader from a folder.file`s names taken into a string array.what i want is when i executed this code segment i want the file name without its extension. But still extensions get printed out.
import java.io.File;
public class Main {
public static void main(String[] args) {
File file=new File("D:\\C_App\\PDF");
String[] files = file.list();
for(String string : files) {
string.substring(0, string.length());
System.out.println(string);
}
}
}
Can anyone help me to solve this? Thanks.