u24
This commit is contained in:
parent
6c6523afd2
commit
7b547be58e
Binary file not shown.
|
@ -0,0 +1,32 @@
|
|||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Klasse zum duplizieren von Leerzeilen in Textdateien
|
||||
*/
|
||||
public class DoubleSpace {
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
doubleSpace("test.txt","out.txt");
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplizierzt Leerzeilen bzw Zeilenumbrueche der
|
||||
* Datei inputFileName und speichert das Ergebnis in
|
||||
* outputFileName ab
|
||||
*/
|
||||
public static void doubleSpace(String inputFileName, String outputFileName) throws FileNotFoundException {
|
||||
Scanner input = new Scanner(new File(inputFileName));
|
||||
PrintStream output = new PrintStream(new File(outputFileName));
|
||||
|
||||
if (input.hasNextLine()) {
|
||||
output.println(input.nextLine());
|
||||
}
|
||||
while (input.hasNextLine()) {
|
||||
output.println();
|
||||
output.println(input.nextLine());
|
||||
}
|
||||
|
||||
output.close();
|
||||
input.close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
hallo
|
||||
|
||||
hier
|
||||
|
||||
|
||||
|
||||
sind
|
||||
|
||||
|
||||
|
||||
leerzeichen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
yes
|
|
@ -0,0 +1,9 @@
|
|||
hallo
|
||||
hier
|
||||
|
||||
sind
|
||||
|
||||
leerzeichen
|
||||
|
||||
|
||||
yes
|
Loading…
Reference in New Issue