Short Answer - Trim spaces at the beginning and at the end of the answer

Short Answer - Trim spaces at the beginning and at the end of the answer

od Alexander Kuptsov -
Število odgovorov: 1

Hello everyone,

I've always thought that Moodle somehow trims white spaces at the beginning and at the end of a short answer that the student inputs but apparently it does not. Today I had a question where the answer was 'is' and my student typed in 'is   ', hitting the space bar accidentally or something. His answer was marked as incorrect and I had to rack my brain and experiment before I realised what was wrong.

Is it somehow possible to tweak the Moodle code, so that it would first trim all the white spaces at the beginning and at the end of short answers? In this very case, for example, for my answer 'is' answers like '    is' and ' is     ' would be correct.

I appreciate any help


Povprečje ocenitev: -
V odgovor na Alexander Kuptsov

Re: Short Answer - Trim spaces at the beginning and at the end of the answer

od Tim Hunt -
Slika Core developers Slika Documentation writers Slika Particularly helpful Moodlers Slika Peer reviewers Slika Plugin developers

Moodle does trim whitespace (https://github.com/moodle/moodle/blob/master/question/type/shortanswer/question.php#L48)

However, in the world of unicode, what exactly is whitespace is a complicated question. Can you get the exact sequence of unicode characters that has been submitted?