From 67856e653f49663dc72cbb01504e7ac9148f7ebe Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 22 Oct 2022 09:34:27 +0200 Subject: Remove whitespaces in response Around and between words. This prevent saying a response is false when the only difference is whitespaces. --- src/gui/question.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/question.rs b/src/gui/question.rs index 1c4f179..727daa9 100644 --- a/src/gui/question.rs +++ b/src/gui/question.rs @@ -202,8 +202,8 @@ pub fn ask( } fn is_correct(input: &str, responses: &[String]) -> bool { - // Trim input - let input = input.trim(); + // Remove whitespaces + let input = input.split_whitespace().map(|word| word.trim()).collect::>().join(" "); responses .iter() -- cgit v1.2.3