From aa2c30e3ec543efb84d2557c43747544c93efad5 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Sun, 31 Oct 2010 23:39:37 +0000 Subject: Outputs on a single line, sends exit code 1 if no result was found --- bladictionary.java | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bladictionary.java b/bladictionary.java index 9f177af..403c821 100644 --- a/bladictionary.java +++ b/bladictionary.java @@ -40,8 +40,7 @@ public class bladictionary { Boolean definition = false; Boolean definition2 = false; Boolean wn = false; - String[] defLines = new String[50]; - int i = 0; + String result = ""; //Read every line while ((line = br.readLine()) != null) { @@ -88,7 +87,14 @@ public class bladictionary { { parts = line.split("\\["); - System.out.println(parts[0]); + if (result.equals("")) + { + result = parts[0]; + } + else + { + result = result + "; "+ parts[0]; + } } else { @@ -100,6 +106,17 @@ public class bladictionary { } } } + + if(!result.equals("")) + { + System.out.println(result); + System.exit(0); + } + else + { + System.exit(1); + } + } } \ No newline at end of file -- cgit v1.2.3