Detecting only the first letter in a scanner

I made a course (Like it teaches and Tests Users Knowledge). And I just want to detect the first part of what they write. Like I made commands such as
/start
or
/learn
. But if they add a space or adds anything. It won't be able to detect it using
switch
. Is it possible to just detect the first part? Or the first letter? Because The Exams to answer the exam. You just put a letter like a, b, c, d. If they add a space it will say Unknown input.
Was this page helpful?