1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-06-26 13:33:02 +02:00

Trim input

This commit is contained in:
Carlos Galindo 2016-06-12 16:17:56 +02:00
parent 10420215d6
commit b557ec9374
Signed by: kauron
GPG key ID: 83E68706DEE119A3

View file

@ -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);