-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.java
More file actions
70 lines (70 loc) · 2.4 KB
/
filter.java
File metadata and controls
70 lines (70 loc) · 2.4 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.image.BufferedImage;
class filter{
public static void main(String[] args){
filter f = new filter();
f.filt();
Timer timer = new Timer();
TimerTask tt = new TimerTask(){
public void run(){
Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
if(hour == 0&&minute == 0&&second ==10){
f.filt();
}
}
};
timer.schedule(tt, 1000, 1000);
}
public void filt(){
BufferedWriter w = null;
BufferedReader r = null;
try{
File tex= new File("read.txt");
FileWriter wr = new FileWriter(tex);
w = new BufferedWriter(wr);
File text = new File("scan.txt");
Scanner reader = new Scanner(text);
ArrayList<String> texts = new ArrayList<String>();
r= new BufferedReader(new FileReader(new File("Student Locator Spring 2020.csv")));
String f = "";
while(reader.hasNext()){
f = f + reader.nextLine();
}
String[] split = f.split(",");
String line = null;
for(int i = 0; i< split.length; i++){
while ((line = r.readLine())!=null){
String[] splitrow = line.split(",");
String name = splitrow[2] + " "+splitrow[1];
name = name.toLowerCase();
String t = split[i].toLowerCase();
if(t.contains(name)||(t.contains("greg neat"))){
w.write(split[i]+",");
break;
}
}
r.close();
r= new BufferedReader(new FileReader(new File("Student Locator Spring 2020.csv")));
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
if((w != null)&&(r!=null)){
try{
w.close();
r.close();
}
catch(Exception e){
e.printStackTrace();
}
}
}
}
}