リモートで働くプログラマーの検索結果

リモ太がググったことの覚書

Rubyで文字列に特定の文字が含まれているか調べる

docs.ruby-lang.org

Stringクラスにinclude?というメソッドがある

text = "123abc"

text.include?("123")
=> true

text.include?("4")
=> false

text.include?("3a")
=> true

text.include?("3b")
=> false