How can I check that string starts with a given letter in Ruby?
You can use String#start_with?
method
'String'.start_with? 'S'
=> true
Also you can list possible variants of beginning
'String'.start_with? 'E', 'S'
=> true
you can use regex
str.match /^X/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With