-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathParser.java
More file actions
26 lines (25 loc) · 864 Bytes
/
Parser.java
File metadata and controls
26 lines (25 loc) · 864 Bytes
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
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;
public class Parser {
public static void main(String[] args) throws FileNotFoundException {
Scanner input = new Scanner(new File("quotes9u.txt"));
PrintStream output = new PrintStream(new File("quotes9.txt"));
int counter = 0;
while (input.hasNextLine()) {
String line = input.nextLine().trim();
System.out.println(line);
System.out.println(counter++);
if (line.length() != 0) {
if (line.charAt(0) != '*') {
output.print(line + " ");
} else {
//output.println();
}
} else {
output.println();
}
}
}
}