Rubyで文字列に特定の文字が含まれているか調べる
Stringクラスにinclude?というメソッドがある
text = "123abc" text.include?("123") => true text.include?("4") => false text.include?("3a") => true text.include?("3b") => false
Stringクラスにinclude?というメソッドがある
text = "123abc" text.include?("123") => true text.include?("4") => false text.include?("3a") => true text.include?("3b") => false