Skip to content

Commit 5149921

Browse files
JavaScalaDeveloperJavaScalaDeveloper
authored andcommitted
删除c语言代码
1 parent d20ab0e commit 5149921

File tree

2,702 files changed

+3189
-35633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,702 files changed

+3189
-35633
lines changed

change/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# 替换所有的除Java以外的代码
22
- 正则匹配```python[\s\S]*?```
33

4-
[//]: # (- 正则匹配[English Version]([\s\S]*?))
4+
- 正则匹配\[English Version]([\s\S]*?)\)
55

6-
- 清除空格
6+
- 清除空行 ^\s*$
77
- 给所有class添加package:AddPackagePrefix
8-
- 合并所有md:MergeMdFiles
8+
- 合并所有md:MergeMdFiles

change/scripts/ParseMenu.java

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package change.scripts;
2+
3+
import java.io.BufferedReader;
4+
import java.io.FileInputStream;
5+
import java.io.IOException;
6+
import java.io.InputStreamReader;
7+
import java.nio.file.Files;
8+
import java.nio.file.Paths;
9+
import java.util.ArrayList;
10+
import java.util.List;
11+
import java.util.Map;
12+
import java.util.stream.Collectors;
13+
14+
public class ParseMenu {
15+
public static void main(String[] args) {
16+
List<String> lines = readLines("change/scripts/input/menu.txt");
17+
List<LineData> lineData = parseLines(lines);
18+
Map<String, String> num2LevelMap = lineData.stream().collect(Collectors.toMap(LineData::getA, LineData::getD));
19+
System.out.println(num2LevelMap);
20+
Map<String, List<LineData>> collect = lineData.stream().collect(Collectors.groupingBy(LineData::getD));
21+
// System.out.println(collect);
22+
}
23+
24+
private static class LineData {
25+
private String a;
26+
private String b;
27+
private String c;
28+
private String d;
29+
private String e;
30+
31+
@Override
32+
public String toString() {
33+
return "LineData{" +
34+
"a='" + a + '\'' +
35+
", b='" + b + '\'' +
36+
", c='" + c + '\'' +
37+
", d='" + d + '\'' +
38+
", e='" + e + '\'' +
39+
'}';
40+
}
41+
42+
public String getA() {
43+
return a;
44+
}
45+
46+
public String getB() {
47+
return b;
48+
}
49+
50+
public String getC() {
51+
return c;
52+
}
53+
54+
public String getD() {
55+
return d;
56+
}
57+
58+
public String getE() {
59+
return e;
60+
}
61+
62+
public LineData(String[] fields) {
63+
this.a = fields[0].trim();
64+
this.b = fields[1].trim();
65+
this.c = fields[2].trim();
66+
this.d = fields[3].trim();
67+
this.e = fields[4].trim();
68+
}
69+
// getter 和 setter 方法省略
70+
}
71+
72+
public static List<LineData> parseLines(List<String> lines) {
73+
List<LineData> result = new ArrayList<>();
74+
for (String line : lines) {
75+
String[] fields = line.substring(1, line.length() - 1).split("\\|"); // 去掉首尾的 "|" 符号
76+
result.add(new LineData(fields));
77+
}
78+
return result;
79+
}
80+
81+
/**
82+
* 读取每一行文件
83+
* @param filePath
84+
* @return
85+
*/
86+
public static List<String> readLines(String filePath) {
87+
List<String> lines = new ArrayList<>();
88+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get(filePath))))) {
89+
String line;
90+
while ((line = reader.readLine()) != null) {
91+
lines.add(line);
92+
}
93+
} catch (IOException e) {
94+
e.printStackTrace();
95+
}
96+
return lines;
97+
}
98+
99+
}

change/scripts/input/menu.txt

Lines changed: 2695 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)