OOP2019-00-创建Markdown格式的日报
java源程序如下:
import java.io.FileOutputStream;
import java.io.IOException;
/**
* 运行方式: java -jar 本打包文件名.jar 年 月 本月天数
* @author subo
*/
public class Main {
public static void main(String[] args) {
int year = Integer.parseInt(args[0]);
int month = Integer.parseInt(args[1]);
int day = Integer.parseInt(args[2]);
createDayReport(year, month, day);
}
private static void createDayReport(int year, int month, int day) {
String yearString = "" + year;
String monthString = month < 10 ? "0" + month : "" + month;
String fileName = "工作计划" + yearString + "年" + monthString + "月.md";
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("#").append(fileName).append("\n");
conten