How to find result out of a string

Thanks for this solution, could you please share a screenshot how to apply switch case for this.

Lets say i have stored the whole line in a string Str.