-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathOnlineToCSV.java
43 lines (42 loc) · 1.06 KB
/
OnlineToCSV.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
class OnlineToCSV
{
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new FileReader("README.md"));
BufferedWriter writer = new BufferedWriter(new FileWriter("ZInfo/OnlineInfo.csv"));
String nextLine = "";
while ((nextLine = reader.readLine()) != null)
{
if (nextLine.equals("## Arrays")) break;
}
while ((nextLine = reader.readLine()) != null)
{
String[] tokens = nextLine.split("[|]");
if (tokens.length == 6)
{
String[] linkParts = tokens[3].split("/");
for (int i = 0; i < linkParts.length; ++i)
{
String linkPart = linkParts[i];
if (linkPart.equals("practice.geeksforgeeks.org"))
{
writer.write(linkParts[i+2]+","+tokens[5]);
writer.newLine();
break;
}
}
//writer.write();
//writer.write(",");
//writer.write();
//writer.newLine();
}
}
reader.close();
writer.close();
}
}