justify tool: accepts \r\n text
authorNiki Roo <niki@nikiroo.be>
Tue, 10 Apr 2018 08:08:34 +0000 (10:08 +0200)
committerNiki Roo <niki@nikiroo.be>
Tue, 10 Apr 2018 08:08:34 +0000 (10:08 +0200)
src/be/nikiroo/utils/main/justify.java

index cf589059a5ebf398cea085fcfc06913067e32d73..32cfb103a8d1deea21df9d2e15aaa646a966f3b5 100644 (file)
@@ -38,7 +38,7 @@ public class justify {
                // TODO: move to utils?
                List<String> lines = new ArrayList<String>();
                Scanner scan = new Scanner(System.in);
-               scan.useDelimiter("[\r\n]");
+               scan.useDelimiter("\r\n|[\r\n]");
                try {
                        StringBuilder previous = null;
                        StringBuilder tmp = new StringBuilder();
@@ -90,6 +90,7 @@ public class justify {
                return line.length() == 0 //
                                || line.charAt(line.length() - 1) == '.'
                                || line.charAt(line.length() - 1) == '"'
-                               || line.charAt(line.length() - 1) == '»';
+                               || line.charAt(line.length() - 1) == '»'
+               ;
        }
 }