If statement in Ruby using Regex

前端 未结 4 1224
终归单人心
终归单人心 2021-01-29 07:30

Everything seems to be working fine except the commented line:

#return false if not s[0].upcase =~ /AZ/

and the fourth check.

What is t

4条回答
  •  天涯浪人
    2021-01-29 08:07

    try this...

    def starts_with_consonant? s
      /^[^aeiou\d\W]/i =~ s ? true : false
    end
    

提交回复
热议问题