From b557ec93745dd9244882c258458e70584433abe7 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Sun, 12 Jun 2016 16:17:56 +0200 Subject: [PATCH] Trim input --- src/main/java/es/kauron/jstudy/model/TestItem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/es/kauron/jstudy/model/TestItem.java b/src/main/java/es/kauron/jstudy/model/TestItem.java index 563042e..f3d68e4 100644 --- a/src/main/java/es/kauron/jstudy/model/TestItem.java +++ b/src/main/java/es/kauron/jstudy/model/TestItem.java @@ -82,8 +82,8 @@ public class TestItem { String line = in.nextLine(); if (!line.matches("..*" + separator + "..*")) continue; int index = line.indexOf(separator); - String question = line.substring(0, index); - String answer = line.substring(index + separator.length()); + String question = line.substring(0, index).trim(); + String answer = line.substring(index + separator.length()).trim(); index = answer.indexOf(separator); if (index != -1) answer = answer.substring(0, index);