import java.io.File;
/**
* 文件名大写转小写,小写转大写
* @author zjq
*
*/
public class EditName {
public static void main(String[] args) {
File file = new File("D:\\Files\\DataSourceFile02.zip");
String name = file.getName();
String fileName = name.substring(0, name.lastIndexOf("."));
System.out.println(fileName);
StringBuilder sb = new StringBuilder();
if (fileName!=null) {
for (int i = 0; i < fileName.length(); i++) {
char c = fileName.charAt(i);
if (Character.isUpperCase(c)) {
// System.out.print(c+" ");
// System.out.print(Character.toLowerCase(c)+" ");
sb.append(Character.toLowerCase(c));
} else if(Character.isLowerCase(c)){
sb.append(Character.toUpperCase(c));
}
}
}
System.out.println(sb.toString()+"02");
}
}
时间: 2024-10-01 22:23:06