Skip to content

Instantly share code, notes, and snippets.

@toomasr
Created September 29, 2012 15:56
Show Gist options
  • Save toomasr/3804445 to your computer and use it in GitHub Desktop.
Save toomasr/3804445 to your computer and use it in GitHub Desktop.
Quick convert
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