During loop my list contains csv files, I want to get file name, under which I will save my output.
Example:
File list: t1.csv
, t2.csv
, t3.csv
Output list should look: t1.xml, t2.xml, t3.xml
sample.java
List<String> csvFiles = new ArrayList<String>();
try {
File[] files = new File(textCSV.getText()).listFiles();
for (File file : files) {
if (file.isFile()) {
csvFiles.add(file.getName());
}
}
for(int i=0;i<csvFiles.size();i++) {
System.out.println(csvFiles.get(i));
String Output = ".xml" //how to put here csv name
}
}
You can rewrite like this.