Created
September 29, 2012 15:56
-
-
Save toomasr/3804445 to your computer and use it in GitHub Desktop.
Quick convert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
public class ConvertJF { | |
public static void main(String[] args) throws Exception { | |
InputStreamReader isr = new InputStreamReader(System.in); | |
BufferedReader bf = new BufferedReader(isr); | |
String line = null; | |
List<String> results = new ArrayList<String>(); | |
while ((line = bf.readLine()) != null) { | |
String newLine = line.replaceAll("\\s+", "||"); | |
newLine = "||" + newLine + "|| - || - ||"; | |
results.add(newLine); | |
} | |
System.out.println("\nResults\n"); | |
for (Iterator<String> ite = results.iterator(); ite.hasNext();) { | |
String string = (String) ite.next(); | |
System.out.println(string); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment