Ruby 2.7.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Symbolクラス > start_with?
start_with?(*prefixes) -> bool
[permalink][rdoc]self の先頭が prefixes のいずれかであるとき true を返します。
(self.to_s.start_with?と同じです。)
[SEE_ALSO] Symbol#end_with?
[SEE_ALSO] String#start_with?
:hello.start_with?("hell") #=> true
:hello.start_with?(/H/i) #=> true
# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false