diff options
author | Joris | 2022-10-22 09:34:27 +0200 |
---|---|---|
committer | Joris | 2022-10-22 09:34:27 +0200 |
commit | 67856e653f49663dc72cbb01504e7ac9148f7ebe (patch) | |
tree | ce783e7317f5a5dc8dd5c4c09b1fa87de8f3b97d /src | |
parent | 902be75848b99b4f60bbd74cd305b899afeeac78 (diff) |
Remove whitespaces in response
Around and between words. This prevent saying a response is false when
the only difference is whitespaces.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/question.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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<B: Backend>( } 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::<Vec<&str>>().join(" "); responses .iter() |