1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-12-23 00:43:32 +01: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(); String line = in.nextLine();
if (!line.matches("..*" + separator + "..*")) continue; if (!line.matches("..*" + separator + "..*")) continue;
int index = line.indexOf(separator); int index = line.indexOf(separator);
String question = line.substring(0, index); String question = line.substring(0, index).trim();
String answer = line.substring(index + separator.length()); String answer = line.substring(index + separator.length()).trim();
index = answer.indexOf(separator); index = answer.indexOf(separator);
if (index != -1) if (index != -1)
answer = answer.substring(0, index); answer = answer.substring(0, index);