iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 20
0
自我挑戰組

Women in IT field系列 第 20

Quick Summary in Java

  • 分享至 

  • xImage
  •  

Java is a complete introduction of object-oriented programming. It was an open source programming and right is being charged by oracle since oracle is the one to maintain java which might have been real.

Example code as:

package DownloadTheStatistic;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class FileNameOps {

public static void main(String[] argv) throws IOException {

File folder = new File("C:\Downloads");
File[] listOfFiles = folder.listFiles();
int m2Only = 1;

for (int i = 0; i < listOfFiles.length; i++) {
String oldF=listOfFiles[i].getName();
if (oldF.contains("QuickMobile Regression and Release_")){
File f = new File("C:\Downloads\"+oldF);

if (oldF.contains("App")||oldF.contains("(1)")) {
String z;
if(oldF.contains("App")&& oldF.contains("(1)")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf("
"));
z= x+"App_M2"+y.substring(0, y.indexOf("(")-1)+y.substring(y.lastIndexOf("."));
}else if(oldF.contains("App")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf("
"));
z= x+"App_M1"+y;
}else if(oldF.contains("Tab")){
String x = oldF.substring(0, oldF.indexOf("")+1);
String y =oldF.substring(oldF.lastIndexOf("
"));
z= x+"Tab_M2"+y.substring(0, y.indexOf("(")-1)+y.substring(y.lastIndexOf("."));
}else{
String x = oldF.substring(oldF.lastIndexOf(""), oldF.indexOf("(")-1);
String y =oldF.substring(oldF.lastIndexOf("."));
z= oldF.substring(0, oldF.lastIndexOf("
"))+"M2"+x+y;
}
f.renameTo(new File("C:\Downloads\"+z));
}else if(m2Only==1){
String y;
if(oldF.contains("Tab")){
y = oldF.substring(0, oldF.indexOf("
"))+"Tab_M2"+oldF.substring(oldF.lastIndexOf(""));
}else{
String x = oldF.substring(oldF.lastIndexOf(""));
y= oldF.substring(0, oldF.lastIndexOf("
"))+"M2"+x;
}
f.renameTo(new File("C:\Downloads\"+y));
}
else{
String y;
if(oldF.contains("Tab")){
y = oldF.substring(0, oldF.indexOf("
"))+"Tab_M1"+oldF.substring(oldF.lastIndexOf(""));
}else{
String x = oldF.substring(oldF.lastIndexOf(""));
y= oldF.substring(0, oldF.lastIndexOf("
"))+"_M1"+x;
}
f.renameTo(new File("C:\Downloads\"+y));
}

}
}

System.out.println("conversion is done");
}
}


上一篇
About open source
下一篇
Different Programming Languages Quick Review
系列文
Women in IT field30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言