0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rubyで文字列に特定の文字列が含まれているか判定する(include?メソッド)

Last updated at Posted at 2020-11-25

ruby 2.7.0についての記事です

#公式ドキュメントより
"hello".include? "lo"   #=> true
"hello".include? "ol"   #=> false

#自分なりの活用法
arry = ["hello","string","integer"]
arry.each do |s|
  if s.include? "e"
    puts s
  end
end
# => hello
     integer
#公式ドキュメントより
a = [ "a", "b", "c" ]
a.include?("b")       #=> true
a.include?("z")       #=> false
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?